Jump to content

Combination table


jesper03

Recommended Posts

Hi everyone, I implemented a simple function in my shop in order to show a table under the product's description to show only some kind of combinations.

More precisely, for some product I added the attribute "Quantity" and "Graphic" so what I have is for example:

QUANTITY

100

200

500

1000

GRAPHIC

YES

NO

 

Choosing "Graphic YES" the price is improved by 5€.

In my table I want to show only price related to the combinations of "Quantity" and "Graphic NO".

 

I putted this in my ProductController.php

$groups[$row['id_attribute_group']]['name_price'][$row['id_attribute']] = array('name' => $row['attribute_name'],'price' => number_format($row['price'],2), 'attribute_id' => $row['id_attribute']); 

and this in my product.tpl

{if $product->id_category_default == 17}
		<div id="avviso_upload" style="font-weight:bold;">I seguenti prezzi si intendono con realizzazione grafica a carico del cliente.</div>	
		<div id="attributes">
			<div class="clearfix"></div>
			{foreach from=$groups key=id_attribute_group item=group}
				{if $group.attributes|@count}
					<fieldset class="attribute_fieldset">				
						{assign var="groupName" value="group_$id_attribute_group"}
						<div class="attribute_list">
							{if ($group.group_type == 'radio')}
								<table id="table_quantita">
									<tr class="table_head">
										<th class="th_quantita">Quantità</th>
										<th class="th_quantita">IVA esclusa</th> 
										<th class="th_quantita">IVA inclusa</th>
										<th class="th_quantita"><i class="icon-shopping-cart th_icon"></i></th>
									</tr>
									{foreach from=$groups key=id_attribute_group item=group}
										{if $group.attributes|@count}
											{foreach from=$group.name_price key=id_attribute item=group_attribute}
											{if $group.name|strstr:"Quantità"}
											        <tr class="tr_quantita">
											            <td class="td_quantita">{$group_attribute.name}</td>
												    <td class="td_quantita">{$currencySign|html_entity_decode:2:"UTF-8"} {$group_attribute.price}</td>
												    <td class="td_quantita">{convertPrice price=({$group_attribute.price}*1.22)}</td>
    												    <td class="td_quantita">
												         <input type="radio" class="attribute_radio" name="{$groupName|escape:'html':'UTF-8'}" value="{$id_attribute}" {if ($group.default == $id_attribute)} checked="checked"{/if} />
												    </td>
												</tr>
											{/if}
											{/foreach}
										{/if}
									{/foreach}
								</table>
							{/if}
						</div>
					</fieldset>
				{/if}
			{/foreach}
		</div>
		<div id="avviso_upload" style="font-weight:bold; font-size: 16px;">*La grafica fornita dal cliente può essere inviata tramite l'apposito modulo sottostante prima di procedere con l'ordine o in alternativa può essere inviata in seguito con la funzione <a href="http://www.tipografiagrillo.com/index.php?controller=contact3" target="blank"><span style="color: #b22222;">Invia File</span></a> specificando il codice dell'ordine ed eventuali dettagli aggiungitivi.<br>
		</div>
		<a href="http://www.tipografiagrillo.com/index.php?controller=contact2" target="blank"><div class="text_preventivo_prodotti"><h2 class="text_preventivo_h2"> Per quantità e formati personalizzati richiedi un preventivo</h2></div></a>
				
	{/if} 

I created all the combination using the Combination Generator.

The problem is that for some rows of the table I have the price related to "Graphic YES" that is not what I want.

In the attached file you can see my table, the 5° row is wrong, because the price 130€ is related to the combination of Quantity 2500 and graphic Yes while all the other prices are related to the combination of Quantity and Graphic No.

I hope that the problem is clear and that someone can help me.

Thanks in advance.

 

post-1291798-0-69615500-1474015317_thumb.png

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...