Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2006
    Posts
    8
    Plugin Contributions
    0

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

    Code:
    if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID){
                $attr_value = $products[$i]['attributes_values'][$option];
              } else {
                $attr_value = $attributes->fields['products_options_values_name'];
              }
    		  $strModel_100 = "1in";
                      $strDisplay_100 = "100-";
    		  if ($attr_value == $strModel_100){
    			$this->products[$index]['model'] = $strDisplay_100 . $products[$i]['model']; 
    		  }

  2. #2
    Join Date
    Sep 2006
    Posts
    8
    Plugin Contributions
    0

    Default Re: product_model based on attributes

    Any ideas?

  3. #3
    Join Date
    Sep 2006
    Posts
    8
    Plugin Contributions
    0

    Default Re: product_model based on attributes

    I got it sorted

    Code:
    $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; 
    		  }

 

 

Similar Threads

  1. v150 Interested in Attributes based upon Attributes add-on - Anyone else interested?
    By sports guy in forum All Other Contributions/Addons
    Replies: 10
    Last Post: 16 Jun 2015, 05:52 AM
  2. Backslash gets stripped from Product_Model
    By LuMe96 in forum Basic Configuration
    Replies: 4
    Last Post: 16 Nov 2007, 09:48 AM
  3. product_model based on attributes
    By milksamsa in forum Templates, Stylesheets, Page Layout
    Replies: 16
    Last Post: 4 Oct 2006, 07:23 AM
  4. Sub-attributes? Making attributes of attributes appear based on which you select?
    By pioupioun in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 7 Jun 2006, 11:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg