Displaying related product's adjusted price (problem 1: toolkit vassign isnt working)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sapphireblue
    Mini Mivite

    • Apr 2006
    • 18

    #1

    Displaying related product's adjusted price (problem 1: toolkit vassign isnt working)

    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:

    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>
    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.
  • wcw
    Developer Partner

    • Mar 2006
    • 11329

    #2
    Re: Displaying related product's adjusted price (problem 1: toolkit vassign isnt work

    Use the examples in the module's admin for a starting point. In the item tokens you see l.all_settings instead of l.settings
    Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
    Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
    Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
    Facebook http://www.facebook.com/EmporiumPlus
    Twitter http://twitter.com/emporiumplus

    Comment

    • Sapphireblue
      Mini Mivite

      • Apr 2006
      • 18

      #3
      Re: Displaying related product's adjusted price (problem 1: toolkit vassign isnt work

      Originally posted by wcw View Post
      Use the examples in the module's admin for a starting point. In the item tokens you see l.all_settings instead of l.settings
      Thanks, Bill. That gets me past my vassign problem and a little further down in my code before the point where it all stops working. I cannot for the life of me, not for lack of searching, figure out how to reference price group info of related products.

      My code at present:

      Code:
      <mvt:item name="toolkit" param="vassign|relformnewprice|l.all_settings:related_product:formatted_price" />
      <mvt:item name="toolkit" param="pgroup-p|relprdcount|l.all_settings:related_product:pgrpcount" />
      <mvt:if expr="g.relprdcount GT 0">
          <mvt:foreach iterator="product_pgroup" array="product_pgroups">
              <mvt:item name="toolkit" param="newsubstring|relpercent|l.all_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.all_settings:related_product:price|g.relpercent" />
              <mvt:item name="toolkit" param="math_subtract|relnewprice|l.all_settings:related_product:price|relnewprice" />
          </mvt:foreach>
          <mvt:item name="toolkit" param="currencyformat|relformnewprice|relnewprice" />
      </mvt:if>
      I know "product_pgroups" isn't the right array to reference for RELATED product price groups, but can't figure out what is. Would be grateful for anyone who can offer any assist.

      Comment

      • wcw
        Developer Partner

        • Mar 2006
        • 11329

        #4
        Re: Displaying related product's adjusted price (problem 1: toolkit vassign isnt work

        The tool kit pgroup-p token is not for what you are trying to do. It simply lists the names of the price groups a product is assigned to. The built in related products token already gives you the adjusted price of products in the related products. No 3rd party module needed.
        Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
        Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
        Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
        Facebook http://www.facebook.com/EmporiumPlus
        Twitter http://twitter.com/emporiumplus

        Comment

        • Sapphireblue
          Mini Mivite

          • Apr 2006
          • 18

          #5
          Re: Displaying related product's adjusted price (problem 1: toolkit vassign isnt work

          Originally posted by wcw View Post
          The tool kit pgroup-p token is not for what you are trying to do. It simply lists the names of the price groups a product is assigned to. The built in related products token already gives you the adjusted price of products in the related products. No 3rd party module needed.
          That's great news, I guess... but I still don't know how, and I still can't find any documentation, and I am so far beyond my budgeted hours on this tiny task that it's ridiculous. Can anyone please provide a link to some relevant documentation? Neither "SMT Items & Entities and the Pages Where They are Used" nor any Google search I can dream up is helping.

          Comment

          • wcw
            Developer Partner

            • Mar 2006
            • 11329

            #6
            Re: Displaying related product's adjusted price (problem 1: toolkit vassign isnt work

            &mvt:product:formatted_price; in the related_products array is the price group adjusted price. You don't do anything special. It is automatically assigned to that variable.
            Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
            Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
            Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
            Facebook http://www.facebook.com/EmporiumPlus
            Twitter http://twitter.com/emporiumplus

            Comment

            • Sapphireblue
              Mini Mivite

              • Apr 2006
              • 18

              #7
              Re: Displaying related product's adjusted price (problem 1: toolkit vassign isnt work

              Originally posted by wcw View Post
              &mvt:product:formatted_price; in the related_products array is the price group adjusted price. You don't do anything special. It is automatically assigned to that variable.
              Alas. This code shows me unadjusted prices:

              Code:
              <mvt:foreach iterator="product" array="related_products:products">
              &mvt:product:formatted_price;
              </mvt:foreach>
              As does &mvt:product:formatted_price; in l.settings for the "parent" product itself, if that's in any way relevant (maybe not, and my convoluted calculations to manually adjust the price work just fine in that context, so moot even if relevant).

              Other ideas, Bill and/or gang?

              Thanks again.

              Comment

              • wcw
                Developer Partner

                • Mar 2006
                • 11329

                #8
                Re: Displaying related product's adjusted price (problem 1: toolkit vassign isnt work

                Something is wrong with your price groups. Go to http://www.emporiumplus.com/1AA00007.html Scroll down to near the bottom and note the prices in the related items. That is using the same array as you are using. Now log in. Return to http://www.emporiumplus.com/1AA00007.html and scroll down. You will see that all of the prices in the related items has changed. The master product (coupon module) did not as I took it out of the price groups while I have this major sale going on ($25.00) for that module.
                Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
                Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
                Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
                Facebook http://www.facebook.com/EmporiumPlus
                Twitter http://twitter.com/emporiumplus

                Comment

                • Bruce - PhosphorMedia
                  Developer Partner











                  • Mar 2006
                  • 11257

                  #9
                  Re: Displaying related product's adjusted price (problem 1: toolkit vassign isnt work

                  Is the product, in the related products list IN the price group YOU are assigned to? If you click that product and go to its own product page, does the correct product show? Are you logged in with a customer account (needed for being in a price groupd)?
                  Bruce Golub
                  Phosphor Media - "Your Success is our Business"

                  Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                  phosphormedia.com

                  Comment

                  Working...
                  X