Forums / Setting Up Categories, Products, Attributes / Price Products in the grid by 'Stock by Attribute' addon?

Price Products in the grid by 'Stock by Attribute' addon?

Locked

Views: 3,729

Results 1 to 1 of 1
This thread is locked. New replies are disabled.
27 Oct 2009, 5:03 PM
#1
salixia avatar

salixia

New Zenner

Join Date:
Oct 2009
Posts:
30
Plugin Contributions:
0

Price Products in the grid by 'Stock by Attribute' addon?

Hi guys,

I given up on finding an addon that lets me price attributes generated by the grid uniquely. I was so sure it existed, because this is a common feature to stores.

Product Example:

[IMG]http://img10.imageshack.us/img10/9317/examplet.gif[/IMG]

So, I am have been trying to code this feature myself. :frusty:

This is as far as I have gotten:

The best way I could figure out to do this was to modify the 'Stock by Attributes' and 'Attribute Grid' addons to also price by attributes.

I figured out where in the attributes.php files I want this feature to show up.

if ($show_attribute_stock == true) {
			$attrib_grid .= '<div class="attrb-price">'.sprintf($attribute_grid_price).'</div>';
			$attrib_grid .= '<div class="attrb-stock">'.sprintf(TEXT_ATTRIBUTE_GRID_IN_STOCK, $attribute_stock).'</div>';
		  }
		break;
	  }
	  $attrib_grid .= '</td>';
	}

Now how do I set up $attribute_grid_price to = a price defined in the Admin/Catalog/Products With Attributes Stock that will add to the start price of the product when added to the cart?

I know I need to add too the functions_lookups.php

// check if any attribute stock values have been set for the product
			// (only of there is will we continue, otherwise we'll use product level data)
			$attribute_stock = $db->Execute("select stock_id from " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " where products_id = '" . (int)$products_id . "'");
      if ($attribute_stock->RecordCount() > 0) {

  		  // prepare to search for details for the particular attribute combination passed as a parameter
	  	  if(sizeof($attributes) > 1){
          $first_search = 'where options_values_id in ("'.implode('","',$attributes).'")';
		    } else {
			    foreach($attributes as $attribute){
				    $first_search = 'where options_values_id="'.$attribute.'"';
          }
        }

Other than that I need some help getting me in the right direction.
Thanks.