Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variation Required Displays Base Price Which Is Not Available #7

Open
thekenshow opened this issue Nov 4, 2018 · 0 comments
Open

Comments

@thekenshow
Copy link

If I enable the Variation Required option, the Products item in a Products page shows "From NNN" where NNN is the price before variation amounts are added. So the user sees a price that is not available to them. For example, with

  • Product Price: $10
  • Variations Group Default Price: $80
  • Variations > Regular: $90
  • Variations > Discount: $25

The user sees From $10, but only $10+$80 or $10+25% prices are available.

This appears to be implemented with the following lines in shoppingcart_core_pricelowest.html.twig:

    {% for group in variationgroups if group.variations|length > 0 and group.grouprequired %}

        {% set groupindex = 'g_' ~ (loop.index * 1000) ~ '_' %}    
        {% set prices = { 0: 100000000 } %}    
        {% for variation in group.variations %}
            {% if variation.price matches '/^[0-9]*\\.?[0-9]+$/' %}            
                {% set prices = prices|merge({(loop.index) : (group.groupasinput ? variation.price * (variation.varmin ? variation.varmin : group.groupmin) : variation.price) }) %}
            {% elseif group.groupprice matches '/^[0-9]*\\.?[0-9]+$/' and group.groupprice > 0 %}            
                {% set prices = prices|merge({(loop.index) : (group.groupasinput ? groupprice * (variation.varmin ? variation.varmin : group.groupmin) : group.groupprice)}) %}
            {% endif %}
        {% endfor %}    
        {% set initialPrice = (initialPrice + min(prices)) %}
    {% endfor %}

Although I can't figure out where the word "From" is being added to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant