Announcement

Collapse
No announcement yet.

Miva Legacy Discount > Variable for Name?

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

    Miva Legacy Discount > Variable for Name?

    Gone full circle on this and so will try again.

    Is there a variable I can check to know when a legacy price group is 'fired'?

    Here is problem. I have a 10% Preffered Partner group. I add a product to it, the dynamic price (not using inventory variants) does not apply the discount to any options that have additional cost added, so if I have 10% off, base price 44.99, then add $10 option the price shows as 54.99 instead of 53.99. However the minibasket and BASK pages show the right amount. I've gone around this a few times and had someone look at it, but no quick answer.

    I note however that if I use a Legacy price group it correctly updates the options (the add on option shows as $9 and the total price as 53.99) so I will use that.

    Here is my next hurdle. The Legacy price group doesn't have a 'discount name' field. I also don't know how to detect a legacy discount. Here is what I am trying now, but not quite right on PROD try not to laught too hard and clue me in if you can

    So I created an availability group to identify 'Preferred Partners' which is not a bad idea because anyone at the office can add and remove people from this group

    Code:
    <!-- Discounts Applied //-->
    <mvt:foreach iterator="discount" array="product:discounts">
    <div class="discount-tag">
    <i class="fas fa-tag" style="color: #A40000"></i> Discount: &mvt:discount:descrip;
    </div>
    
    <!-- Legacy Discount Applied //-->
    <mvt:item name="toolkit" param="agroup|acount" />
    <mvt:if expr="(g.acount GT 0) AND (l.settings:group:discount_count GT 0)">
    <mvt:foreach iterator="customer_agroup" array="customer_agroups">
        <mvt:if expr="'Preferred Partner' CIN l.settings:customer_agroup:name">
            <div class="discount-tag">
                <i class="fas fa-tag" style="color: #A40000"></i> Discount: &mvt:customer_agroup:name;
            </div>
        </mvt:if>
    </mvt:foreach>
    </mvt:if>
    
    </mvt:foreach>
    So this does show the discount name using the <! Legacy Discount Applied -- > section but it doesn't take into account the product being in the legacy price group - it shows for all products if the person is a member of the group.

    I'd appreciate it if someone could show me how I might modify this to also check

    mvt:if expr="(g.acount GT 0) AND (l.settings:group:discount_count GT 0) AND (product-in-legacy-price-group-Discounted-Products-list"

    If there way to grab some sort of unique ID or name for the legacy group I could do that but in looking through the tokens I don't see anything I can use.

    Again, excuse my baby coding efforts.
    Last edited by habreu; 05-20-19, 12:35 PM.

    #2
    Well I found a sample online that may help me

    https://docs.miva.com/code-samples/c...ned-to-product

    Seems okay in a quick test. Please let me know if something seems wrong.

    Code:
    <!-- Discounts Applied //-->
    <mvt:foreach iterator="discount" array="product:discounts">
    <div class="discount-tag">
    <i class="fas fa-tag" style="color: #A40000"></i> Discount: &mvt:discount:descrip;
    </div>
    </mvt:foreach>
    
    <!-- Legacy Discount Applied //-->
    <mvt:do file="g.Module_Feature_PGR_DB" name="l.ok" value="PriceGroup_Load_Name( 'Paint 10%', l.price_group )" />
    
    <mvt:item name="toolkit" param="agroup|acount" />
    <mvt:if expr="(g.acount GT 0)">
    <mvt:foreach iterator="customer_agroup" array="customer_agroups">
        <mvt:if expr="('Preferred Partner' CIN l.settings:customer_agroup:name) AND (l.price_group:id GT 0)">
        <mvt:do file="g.Module_Feature_PGR_DB" name="l.b" value="PriceGroupXProduct_Load( l.price_group:id , l.settings:product:id, l.settings:pricegroupvar )" />
        <mvt:if expr="NOT ISNULL l.settings:pricegroupvar">
            <mvt:comment>Price Group: Assigned</mvt:comment>
            <div class="discount-tag">
                <i class="fas fa-tag" style="color: #A40000"></i> Discount: &mvt:customer_agroup:name;
            </div>
        <mvt:else>
            <mvt:comment>Price Group: Not Assigned</mvt:comment>
            </mvt:if>
        </mvt:if>
    </mvt:foreach>
    </mvt:if>

    Comment

    Working...
    X