Jump to content

[solved] How to display features in Shopping cart summary[solved]


montyex1

Recommended Posts

I have the same problem,

I managed in 'product-list' using this:

{foreach from=$product.features item=feature name=features}{if $feature.id_feature == 6}
  {$features.value|escape:'htmlall':'UTF-8'}
{/if} {/foreach}



But it doesn't seem to work in 'blockcart'

Any clues?

..thanks

Link to comment
Share on other sites

  • 1 month later...

Hi!

I just resolved my problem using the getFrontFeaturesStatic() function of Product class.

Pasting this in your 'shopping-cart-product-line.tpl' template will resolve the "printing features" problem.

 

	{php}
	$feat_product=$this->get_template_vars('product');
	$feat_idprod=intval($feat_product["id_product"]);
	$feat_idlang=intval($this->_tpl_vars["cart"]->id_lang);
	$features_product=Product::getFrontFeaturesStatic($feat_idlang, $feat_idprod);


	if (isset($features_product) && count($features_product)>0)
	{
		for($feat_i=0;$feat_i<count($features_product);$feat_i++)
		{

	   		  $cart_quantity=intval($feat_product["cart_quantity"]);
	   		  $cart_quantity_pcs=$features_product[$feat_i]["value"];
	   		  settype($cart_quantity_pcs, "integer");	
	   		  $cart_quantity_rely=$cart_quantity/$cart_quantity_pcs;

	   		  echo '<span id="ft_'.$feat_product["id_product"].'">('.$cart_quantity_rely.'x) '.$features_product[$feat_i]["value"].'</span>';
		}
	}
	{/php}

 

 

I've just corrected the code snippet... The forum trimmed many pieces of code away!

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

  • 1 month later...
  • 5 months later...

Hi!

I just resolved my problem using the getFrontFeaturesStatic() function of Product class.

Pasting this in your 'shopping-cart-product-line.tpl' template will resolve the "printing features" problem.

{php}
......
{/php}

Bye

 

Thats great! I will try this.

But... is there any more elegant way to get features variable in shopping-cart-product-line.tpl?? I have been trying to pass this variable by editing class/controlers but no success so far ....

Link to comment
Share on other sites

 

Thats great! I will try this.

But... is there any more elegant way to get features variable in shopping-cart-product-line.tpl?? I have been trying to pass this variable by editing class/controlers but no success so far ....

 

Please update the script you have copied. There was some problem with the forum because it has trimmed away a significant part of my code snippet. The correct (and updated) one is above!

Link to comment
Share on other sites

Mate... you saved me... Thanks!!

 

If you want to pass the whole features array to template shopping-cart-product-line.tpl)

use this code:

 

        {php}
                $feat_product=$this->get_template_vars('product');
                $feat_idprod=intval($feat_product["id_product"]);
                $feat_idlang=intval($this->_tpl_vars["cart"]->id_lang);
                $pr_features=Product::getFrontFeaturesStatic($feat_idlang, $feat_idprod);
                $this->assign(pr_features,$pr_features);
        {/php}

 

and then an example how to get features values:

        {foreach from=$pr_features item=feature}
                {if $feature.name == "ipod"}rubbish, and only has {$feature.value} memory{/if}
          {/foreach}

Link to comment
Share on other sites

  • 4 months later...

Arg this is not working for me in a 1.4.6.2 install. I am trying to add the feature values into the cart summary.

 

{foreach from=$product.features item=feature name=features}	  
{$feature.name|escape:'htmlall':'UTF-8'}: {$feature.value|escape:'htmlall':'UTF-8'}
{/foreach}

^does not display anything for me in the cart summary (shopping-cart-product-list.tpl)

 

 

{foreach from=$product.features item=feature}
{$feature.id_feature_value}
{/foreach}

^works, but it is not what I am looking for

 

 

I tried inserting both of the php scripts above, but they just nullify all the code that follows.

 

Thanks in advance for any help.

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