Question

Working with prestashop.

I have set up attributes for a product I need to display these in a table format like this http://www.solopress.com/leaflet-printing/bond-leaflet.html

So across the top it has the Paper Size and each row is the QTY of paper.

In my back-end I have the Attribute QTY for 250/500 etc etc and Size A4/A5/A6 etc

Is there any way I can pull the attributes from the drop down and list them as a table with the price being a Add to Cart button?

Any helpful bits of code or input would be great.

Many thanks!

Was it helpful?

Solution

This is definately not an answer but should give you a heads up on the problem itself.

Your text was not that clear but I'll assume you mean't that you created new attribute values and assigned them under combinations tag.

You have to create a specific table structure ( like you need ) in the product.tpl file and display the specific attrbitues by a smarty forach loop.

By default there are three group types for attributes: select, color, radio. You can add new attributes but without alterations in the database itself ( dont know if you are able to add them via admin panel ) the group types will remain the same.

Here is a code from product.tpl file that might help you

                    {foreach from=$groups key=id_attribute_group item=group}
                {if $group.attributes|@count}
                    <fieldset class="attribute_fieldset span5">
                        <div id="attribute_label_container">
                        <label class="attribute_label" for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} :&nbsp;</label>
                        </div>
                        {assign var="groupName" value="group_$id_attribute_group"}
                        <div class="attribute_list">
                        {if ($group.group_type == 'select')}
                            <select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="attribute_select" onchange="findCombination();getProductAttribute();">
                                {foreach from=$group.attributes key=id_attribute item=group_attribute}
                                    <option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'htmlall':'UTF-8'}">{$group_attribute|escape:'htmlall':'UTF-8'}</option>
                                {/foreach}
                            </select>
                        {elseif ($group.group_type == 'color')}
                            <ul id="color_to_pick_list" class="clearfix">
                                {assign var="default_colorpicker" value=""}
                                {foreach from=$group.attributes key=id_attribute item=group_attribute}
                                <li{if $group.default == $id_attribute} class="selected"{/if}>
                                    <a id="color_{$id_attribute|intval}" class="color_pick{if ($group.default == $id_attribute)} selected{/if}" style="background: {$colors.$id_attribute.value};" title="{$colors.$id_attribute.name}" onclick="colorPickerClick(this);getProductAttribute();">
                                        {if file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')}
                                            <img src="{$img_col_dir}{$id_attribute}.jpg" alt="{$colors.$id_attribute.name}" width="20" height="20" />
                                        {/if}
                                    </a>
                                </li>
                                {if ($group.default == $id_attribute)}
                                    {$default_colorpicker = $id_attribute}
                                {/if}
                                {/foreach}
                            </ul>

                            <input type="hidden" class="color_pick_hidden" name="{$groupName}" value="{$default_colorpicker}" />
                        {elseif ($group.group_type == 'radio')}
                            <ul>
                                {foreach from=$group.attributes key=id_attribute item=group_attribute}
                                    <li>
                                        <input type="radio" class="attribute_radio" name="{$groupName}" value="{$id_attribute}" {if ($group.default == $id_attribute)} checked="checked"{/if} onclick="findCombination();getProductAttribute();" />
                                        <span>{$group_attribute|escape:'htmlall':'UTF-8'}</span>
                                    </li>
                                {/foreach}
                            </ul>
                        {/if}
                        </div>
                    </fieldset>
                {/if}
            {/foreach}

That will display the results in a list as you can see. To make it display in a table structure just edit the correct group_type IF content.

I hope that it helps you a bit.

BR's

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top