Customization of product list attributes module for PrestaShop

Hello,
I've just purchased your product list attribute plugin, and it works fine on the default bootstrap theme.

I'm trying now to integrate it in my custom theme, and I have a couple of questions:

1) I've heavily modified product-list.tpl and the attribute table doesn't appear. Could you tell me on which html element / hook is defined the appearance of the table? 

2) In my product list design, I would like to have one unique dropdown to select the attribute variation, and one unique field to set the quantity. Obviously, it's going to be tricky to get the right max quantity for each variation. So, in your opinion, would it better:
- to modify pla.tpl and related javascript in order to adapt the module to my design
- to graphically hide the table, and populate my custom attribute dropdown through javascript, and then make my own "add to cart" button call the right "add to cart" button inside the table.


Thanks for you help!

product list attributes prestashop

PrestaShop displayProductDeliveryTime default hook

Hello

Module product list attribute plugin uses default hook in prestashop named displayProductDeliveryTime - in case of prestashop 1.6.x, by default - it is not necessary to alter anything. Module is just plug and play.
Simply saying: verify if your product-list.tpl has execution code of hook: 
{hook h="displayProductDeliveryTime" product=$product} 

by default it is in product-list.tpl file - line 111: https://github.com/PrestaShop/PrestaShop/blob/1.6.1.x/themes/default-bootstrap/product-list.tpl


Change the way of how module shows combinations

In your case, an easiest way in my opinion will be a modificaiton of pla.tpl.
Remove standard add to cart from your product-list.tpl, then it will be necessary to alter pla.tpl file. By default module shows <table> where each combination is a <tr></tr> element.

Instead of <table> you can create <select></select> where each combination will be an <option></option> where value will be an id of combination.


{*
 * PrestaShop module created by VEKIA, a guy from official PrestaShop community ;-)
 *
 * @author    VEKIA https://www.prestashop.com/forums/user/132608-vekia/
 * @copyright 2010-2017 VEKIA
 * @license   This program is not free software and you can't resell and redistribute it
 *
 * CONTACT WITH DEVELOPER http://mypresta.eu
 * support@mypresta.eu
 *}

{if count($pla_matrix)>0}    
    <form action="{$link->getPageLink('cart')|escape:'html'}" method="post" id="ct_matrix_{$ctk|escape:'':'utf-8'}" name="ct_matrix_{$ctk|escape:'':'utf-8'}">
        <input type="hidden" name="token" value="{Tools::getToken(false)}"/>
        <input type="hidden" name="pla_idProduct_{$id_product|escape:'':'utf-8'}" id="pla_idProduct_{$id_product|escape:'':'utf-8'}" value="{$id_product|escape:'':'utf-8'}"/>
        <input type="hidden" name="add" value="1"/>
        <select id="pla_matrix" class="table table-bordered pla_matrix" name="id_product_{$id_product|escape:'':'utf-8'}_combination" id="id_product_{$id_product|escape:'':'utf-8'}_combination">
            {foreach from=$pla_matrix item=ct key=ctk name='ctr'}
                <option value="{$ctk}">{$ct['combination_name']|substr:0:-2}</option>
            {/foreach}
        </select>
        <span class="decrease_quantity" ><img src="{$content_dir}modules/pla/views/templates/img/minus.png"/></span><input name="qty" class="qty" id="ct_matrix_{$id_product}_idQty" value="0" type="text"/><span class="increase_quantity" ><img src="{$content_dir}modules/pla/views/templates/img/plus.png"/></span>
        <div class="ct_submit btn-primary" id="ct_matrix_{$id_product}_submit" onclick="ajaxCart.add($('#pla_idProduct_{$id_product|escape:'':'utf-8'}').val(), $('#id_product_{$id_product|escape:'':'utf-8'}_combination').val(), true, '#ct_matrix_{$id_product}_submit', $('#ct_matrix_{$id_product|escape:'':'utf-8'}_idQty').val(), null);">{l s='Add' mod='pla'}</div>
    </form>
{/if}
Share on Google Plus

About VEKIA

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment