Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / product_model based on attributes

product_model based on attributes

Locked

Views: 1,292

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
19 Sep 2006, 7:15 PM
#1
duncdamonk avatar

duncdamonk

New Zenner

Join Date:
Sep 2006
Posts:
8
Plugin Contributions:
0

product_model based on attributes

This link will give some history of this topic. Previous Thread

I'll repeat my question here because this seems to be a better place to post it.


A question I would have is what if I want to add the attribute before the model and have it based on attribute conditions. For example:

I have different sizes 1in, 1.5in, 2in. If I did it the way proposed, I get modelx1in. Obviously it's easy to reverse but I want it to display instead of 1in, 100 and instead of 1.5, 150 and so on.

I tried with this simple if statement but I've had no luck. I'm pretty new to PHP and was wondering if I could get your guys input.

if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID){
            $attr_value = $products[$i]['attributes_values'][$option];
          } else {
            $attr_value = $attributes->fields['products_options_values_name'];
          }
		  [B]$strModel_100 = "1in";
                  $strDisplay_100 = "100-";
		  if ($attr_value == $strModel_100){
			$this->products[$index]['model'] = $strDisplay_100 . $products[$i]['model']; [/B]
		  } 
21 Sep 2006, 2:45 PM
#2
duncdamonk avatar

duncdamonk

New Zenner

Join Date:
Sep 2006
Posts:
8
Plugin Contributions:
0

Re: product_model based on attributes

Any ideas?

21 Sep 2006, 7:44 PM
#3
duncdamonk avatar

duncdamonk

New Zenner

Join Date:
Sep 2006
Posts:
8
Plugin Contributions:
0

Re: product_model based on attributes

I got it sorted

$strModel_100 = "1 in";
		  $strModel_100_display = "100-";
		  $strModel_150 = "1.5 in";
		  $strModel_150_display = "150-";
		  $strModel_200 = "2 in";
		  $strModel_200_display = "200-";
		  $strModel_300 = "3 in";
		  $strModel_300_display = "300-";
		  if ($attr_value == $strModel_100){
			$this->products[$index]['model'] = $strModel_100_display . $products[$i]['model'] . " " . $attr_value; 
		  } 
		  if ($attr_value == $strModel_150){
			$this->products[$index]['model'] = $strModel_150_display . $products[$i]['model'] . " " . $attr_value; 
		  } 
		  if ($attr_value == $strModel_200){
			$this->products[$index]['model'] = $strModel_200_display . $products[$i]['model'] . " " . $attr_value; 
		  } 
		  if ($attr_value == $strModel_300){
			$this->products[$index]['model'] = $strModel_300_display . $products[$i]['model'] . " " . $attr_value; 
		  }