Announcement

Collapse
No announcement yet.

Detect legacy price group

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Detect legacy price group

    On BASK I list the discounts each product has. The one legacy price group we use doesn't show &mvt:discount:descrip; I've tried poking around with Tool Belt and Tool Kit code and dug around in the Token List but can't figure out a way to know that discount is in the basket. I was hoping that even if i can't get the specific name I'd be able to at least to add something generic like this to my discount loop

    Code:
     <mvt:if expr="NOT ISNULL l.settings:discount:descrip">
    
    &nbsp;&mvt:discount:descrip;
    
    <mvt:elseif expr="legacy-discount-detected'>
    
    &nbsp;Discount Applied
    
    </mvt:if>
    The first item has the Preferred Partner discount which uses a non-legacy price group. The second one uses a legacy price group and I'd like to add at least a generic description so they know their discount is included.

    Last edited by habreu; 06-13-19, 12:41 PM.

    #2
    Without having a chance to look at the data in this context, I think this might be a case where you won't be able to detect your condition dynamically. You may need to include hardcoded checks for the specific legacy price groups alongside the discount you're looking for.

    Scott
    Need to offer Shipping Insurance?
    Interactive Design Solutions https://www.myids.net
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    Competitive Rates, Custom Modules and Integrations, Store Integration
    AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
    My T-shirt Collection is mostly MivaCon T-shirts!!

    Comment


      #3
      Thanks Scott.

      Comment


        #4
        Here's an extended thought. You could use custom product fields to list the legacy price groups you want to check at the product level. The benefit for using this kind of flexibility is that you wouldn't need to always change the hardcoded SMT script anytime something in the PriceGroup dataset is changed.

        Scott
        Need to offer Shipping Insurance?
        Interactive Design Solutions https://www.myids.net
        MivaMerchant Business Partner | Certified MivaMerchant Web Developer
        Competitive Rates, Custom Modules and Integrations, Store Integration
        AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
        My T-shirt Collection is mostly MivaCon T-shirts!!

        Comment


          #5
          Not sure how I could use that? I see nothing on the BASK page in token list that indicates the legacy price group. On PROD I do see there is a cache variable g.session:cache:resolvedpricegroupandmodulelist_lo ad_customer[10]:cache[3]:name that holds the name. I guess if I could grab this and shove it into a customfield I could carry it forward - a little out of my depth but I'll dig around.

          Comment


            #6
            If I am following, there are a couple of things you need to do. When you cycle through the basket items you look up the items in the specifc pricegroups (that you setup a discount with). In your case, it's a legacy but it's just a lookup of a pricegroup. So, if the product is in the pricegroup you can do whatever you need to do. This check requires that you be explicit, or hardcode, the name of the pricegroup.

            To use a custom field, you would need to read the field you've assigned, the data is probably a comma-delim list of pricegroup names and create an array. Then you can cycle through the list of pricegroups and check to see if the current item is in each.

            I've used Toolkit and Toolbelt and SMT to accomplish similar tasks. If this is something close to your goal, it can be done.

            Scott
            Need to offer Shipping Insurance?
            Interactive Design Solutions https://www.myids.net
            MivaMerchant Business Partner | Certified MivaMerchant Web Developer
            Competitive Rates, Custom Modules and Integrations, Store Integration
            AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
            My T-shirt Collection is mostly MivaCon T-shirts!!

            Comment


              #7
              I am picking through the sample code from Tool Kit and Tool Belt. I didn't get it the first time around but now I see when I dump all the price codes using Tool Belt it is there so I might be able to work it out - thanks for prodding the brain.

              Comment


                #8
                Well I couldn't get it with Tool Belt, or with Miva's price group sample code - more than likely my lack of knowledge- but Tool Kit once again came to the rescue. The prgroup and prgroup-p code gave me what I needed.

                Code:
                <mvt:comment>
                ----------------------------------------------
                - check for legacy price groups by name using
                - tool kit pgroup and pgroup-p functions
                ----------------------------------------------
                </mvt:comment>
                
                <!-- start customer pgroup check -->
                <mvt:item name="toolkit" param="pgroup|pcount" />
                <mvt:if expr="g.pcount GT 0">
                <mvt:foreach iterator="customer_pgroup" array="customer_pgroups">
                
                <!-- start product pgroup check -->
                <mvt:if expr="'ABR Cost Plus' CIN l.settings:customer_pgroup:name">
                  <mvt:item name="toolkit" param="pgroup-p|prdcount|g.Product_Code" />
                  <mvt:if expr="g.prdcount GT 0">
                    <mvt:foreach iterator="product_pgroup" array="product_pgroups">
                    <mvt:if expr="'ABR Cost Plus' CIN l.settings:product_pgroup:name">
                    &mvt:product_pgroup:name;<br>
                    </mvt:if>
                    </mvt:foreach>
                  </mvt:if>
                <!-- end product pgroup check -->
                
                </mvt:if>
                </mvt:foreach>
                </mvt:if>
                <!-- end customer pgroup check -->

                Comment

                Working...
                X