Post by magisterson » Mon Aug 17, 2020 5:17 pm

I want to display quantity type under amount input field on product page. It will be simple text informations for customers for example:
- Price for 1 pallet
- Price for 5 pallets

Any ideas how to do this without any plugin?

It would be great if I could create simple conditional for a specific products ID's like:

Code: Select all

{% if product.id = 14 %}
<div>Price for 2 pallets</div>
{% endif %}
Because only few products need this functionality.

New member

Posts

Joined
Tue Jul 23, 2013 10:15 pm

Post by by mona » Mon Aug 17, 2020 5:20 pm

You can use the Options Built in Function for this.
You just create an option for 1 pallet at standard price and an option for 5 pallets with a plus value for the price
Job done

The prices does not auto update without an extension.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by xxvirusxx » Mon Aug 17, 2020 5:21 pm

Use Discount Tab from product....

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by magisterson » Mon Aug 17, 2020 5:28 pm

It must be only text information, nothing more. I am using custom radio button options for TAX settings. This page is preatty much modified, and options built in Function is completly changed with some extra PHP and JS functions. I must use something else. Only 5 products need this, and simple conditional in TWIG file could work. How to write contitional in twig file for specifid product ID?

Code: Select all

 {% if product_id = 43 %} 
does not working.

New member

Posts

Joined
Tue Jul 23, 2013 10:15 pm

Post by by mona » Mon Aug 17, 2020 5:34 pm

and the problem with xxvirusxx idea which was better in that case anyway is?

and FYI

Code: Select all

{%  if product_id  ==  '43' %}

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by sw!tch » Mon Aug 17, 2020 5:40 pm

magisterson wrote:
Mon Aug 17, 2020 5:28 pm
It must be only text information, nothing more. I am using custom radio button options for TAX settings. This page is preatty much modified, and options built in Function is completly changed with some extra PHP and JS functions. I must use something else. Only 5 products need this, and simple conditional in TWIG file could work. How to write contitional in twig file for specifid product ID?

Code: Select all

 {% if product_id = 43 %} 
does not working.

Code: Select all

    {% if product_id == 43  %}
    do stuff
    {% endif %}

Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by magisterson » Mon Aug 17, 2020 5:43 pm

by mona wrote:
Mon Aug 17, 2020 5:34 pm
and the problem with xxvirusxx idea which was better in that case anyway is?
As I said, my OC has been much modified, and many default plugins, and options was re-built to achieve functionality from UX prototypes. So also discout functionality is modyfied, and we using it to show customers other options.

I need simple conditional, but don't know how to retrieve product ID in OC SYMPHONY code syntax.
Any ideas?

New member

Posts

Joined
Tue Jul 23, 2013 10:15 pm

Post by sw!tch » Mon Aug 17, 2020 5:44 pm

magisterson wrote:
Mon Aug 17, 2020 5:43 pm
by mona wrote:
Mon Aug 17, 2020 5:34 pm
and the problem with xxvirusxx idea which was better in that case anyway is?
As I said, my OC has been much modified, and many default plugins, and options was re-built to achieve functionality from UX prototypes. So also discout functionality is modyfied, and we using it to show customers other options.

I need simple conditional, but don't know how to retrieve product ID in OC SYMPHONY code syntax.
Any ideas?
Plenty of examples just read the docs - https://twig.symfony.com/doc/2.x/tags/if.html

Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by magisterson » Mon Aug 17, 2020 5:45 pm

sw!tch wrote:
Mon Aug 17, 2020 5:40 pm
magisterson wrote:
Mon Aug 17, 2020 5:28 pm
It must be only text information, nothing more. I am using custom radio button options for TAX settings. This page is preatty much modified, and options built in Function is completly changed with some extra PHP and JS functions. I must use something else. Only 5 products need this, and simple conditional in TWIG file could work. How to write contitional in twig file for specifid product ID?

Code: Select all

 {% if product_id = 43 %} 
does not working.

Code: Select all

    {% if product_id == 43  %}
    do stuff
    {% endif %}

And here is my master!
Thank you. My bad. I should use double == to retrieve ID, not single. Single we use to assign variable. Thanks mate!

New member

Posts

Joined
Tue Jul 23, 2013 10:15 pm
Who is online

Users browsing this forum: Bing [Bot], paulfeakins, Semrush [Bot] and 34 guests