I'm trying to use the following code in order to display the adjusted price (after factoring in price group discounts) of related products, within a product's product screen, Page tab. But I'm running into problems on the very first line:
If I delete everything except the first line, then turn on Iatu's Store Helper, I can see that my global relformatted_newprice variable is being created, but assigned no value. Even though I can also see that my l.settings:related_product:formatted_price contains the value I would expect.
The rest of the code may well have other problems—it is basically code someone else wrote to output an adjusted product price on the product page, only with new variable names. The original seems a little convoluted to me, but I thought there would at least be virtue in consistency. Frustratingly, this convoluted code works just fine in its original context. However, I can't even think about that til I figure out this very very basic problem: how to assign a global variable! I'd be so glad for some help with any of these issues. Thanks.
Code:
<mvt:item name="toolkit" param="vassign|relformatted_newprice|l.settings:related_product:formatted_price" />
<mvt:item name="toolkit" param="pgroup-p|relprdcount|l.settings:related_product:code" />
<mvt:if expr="g.relprdcount GT 0">
<mvt:foreach iterator="product_pgroup" array="product_pgroups">
<mvt:item name="toolkit" param="newsubstring|relpercent|l.settings:related_product:product_pgroup:name,1,2" />
<mvt:item name="toolkit" param="sassign|relzero|0." />
<mvt:item name="toolkit" param="concat|percent|relzero|percent" />
<mvt:item name="toolkit" param="math_multiply|relnewprice|l.settings:related_product:price|g.relpercent" />
<mvt:item name="toolkit" param="math_subtract|relnewprice|l.settings:related_product:price|relnewprice" />
</mvt:foreach>
<mvt:item name="toolkit" param="currencyformat|relformatted_newprice|relnewprice" />
</mvt:if>
The rest of the code may well have other problems—it is basically code someone else wrote to output an adjusted product price on the product page, only with new variable names. The original seems a little convoluted to me, but I thought there would at least be virtue in consistency. Frustratingly, this convoluted code works just fine in its original context. However, I can't even think about that til I figure out this very very basic problem: how to assign a global variable! I'd be so glad for some help with any of these issues. Thanks.
Comment