Jump to content

PHP in ptl: in/out-stock in product's miniature


robyciu97

Recommended Posts

Hi guys, sorry for my english but i will try to do my best... 

I need to show in the product's miniature how many combinations are available and how many not.

I'm new and very noob with .ptl (never seen before).

I thought so to use a simple increment x++ in a foreach that count the product-variables. 

Thank you for all =)

Edited by robyciu97 (see edit history)
Link to comment
Share on other sites

7 minutes ago, robyciu97 said:

 

Thank you but now how can i visualize "result" in product.tpl?

Edit product.tpl is incorrect. The product is also present in other tpl and once made shopping the discount would be lost. PrestaShop does not have a similar management.

I can recommend to create two categories : 6X and 12X, and add in these values to be served

SELECT `id_product` FROM `ps_product_tag` WHERE `id_tag`="/*here enter the id of the tag*/"

and for each of the id creates:

INSERT INTO `ps_category_product`(`id_category`, `id_product`) VALUES (/* id new category */,/*id product*/)

Enter area there is a page for your purpose. Go to "price rules" and "Catalog Price Rules". Press "Add new catalog price rule".

From this panel you can decide discounts er category. In principal area select general option and in " Add a new condition group" select the category involved.

The tpl file via tag you can change it so this:

{foreach from=Tag::getProductTags($product->id) key=k item=v}
    {foreach from=$v item=value}
            {if $value==6X}
                    {convertPrice price=$productPrice/6|floatval}
            {else}
                    {convertPrice price=$productPrice}
            {/if}
    {/foreach}
{/foreach}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...