Forums / All Other Contributions/Addons / Modding Stock by Attribute to have SKUs / Model Number

Modding Stock by Attribute to have SKUs / Model Number

Locked

Started by flowerchild5 on 20 May 2009, 3:01 PM · Views: 1,890

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
20 May 2009, 3:01 PM
#1
flowerchild5 avatar

flowerchild5

New Zenner

Join Date:
Mar 2009
Posts:
31
Plugin Contributions:
0

Modding Stock by Attribute to have SKUs / Model Number

I know that alot of people have been trying to establish a SKU for Product variants. It seems to me that all that is needed is to add a another Column to database of "Stocks by Attributes". I did this and have been able to output the model #'s to the admin by editing the output code in the admin/products_with_attributes_stock.php file (haven't gotten to adding it to shopping cart and what not yet).

What I am having trouble with is making it so that I can add skus in the admin section like you are able to do with the attribute inventory. Would anybody happen to know the code to do this.

I think maybe this is what everybody may be looking for in order to have SKU's for Product attributes. Unfortunately my PHP skills are not up to par yet.

17 Jun 2009, 7:27 PM
#2
flowerchild5 avatar

flowerchild5

New Zenner

Join Date:
Mar 2009
Posts:
31
Plugin Contributions:
0

Re: Modding Stock by Attribute to have SKUs / Model Number

For those of you wondering to output the attribute sku in Admin -> Products with attributes stock I first added another column to the table products_with_attributes_stock called attributes_sku

then to display this info I added or changed the following code in admin/products_with_attributes_stock.php

Changed

echo '<th class="stockAttributesHeadingStockId">'.PWA_STOCK_ID.'</th><th class="stockAttributesHeadingVariant">'.PWA_VARIANT.'</th><th class="stockAttributesHeadingQuantity">'.PWA_QUANTITY_IN_STOCK.'</th><th class="stockAttributesHeadingEdit">'.PWA_EDIT.'</th><th class="stockAttributesHeadingDelete">'.PWA_DELETE.'</th>';

To

echo '<th class="stockAttributesHeadingStockId">'.PWA_STOCK_ID.'</th><th class="stockAttributesHeadingVariant">'.PWA_VARIANT.'</th><th class="stockAttributesHeadingSku">'.PWA_ATTRIBUTES_SKU.'</th><th class="stockAttributesHeadingQuantity">'.PWA_QUANTITY_IN_STOCK.'</th><th class="stockAttributesHeadingEdit">'.PWA_EDIT.'</th><th class="stockAttributesHeadingDelete">'.PWA_DELETE.'</th>';

and added

		```php

echo '<td class="stockAttributesCellSku">'."\n";
echo $attribute_products->fields['attributes_sku'];
echo '</td>'."\n";


right after

	```php
sort($attributes_output);
			echo implode("\n",$attributes_output);

and to admin/includes/languages/english/products_with_attributes_stock.php

I added

define('PWA_ATTRIBUTES_SKU', 'Attributes SKU'); 

and to admin/includes/stock_attributes.css

I changed

.stockAttributesHeadingStockId,
.stockAttributesHeadingVariant,
.stockAttributesHeadingQuantity,
.stockAttributesHeadingEdit,
.stockAttributesHeadingDelete {
	border-bottom: 1px solid #ccc;
	width:18%;
}

to

.stockAttributesHeadingSku,
.stockAttributesHeadingStockId,
.stockAttributesHeadingVariant,
.stockAttributesHeadingQuantity,
.stockAttributesHeadingEdit,
.stockAttributesHeadingDelete {
	border-bottom: 1px solid #ccc;
	width:18%;
}

and changed

.stockAttributesCellStockId,
.stockAttributesCellVariant,
.stockAttributesCellQuantity,
.stockAttributesCellEdit,
.stockAttributesCellDelete {
	border-bottom: 1px dotted #ccc;
}

to

.stockAttributesCellSku,
.stockAttributesCellStockId,
.stockAttributesCellVariant,
.stockAttributesCellQuantity,
.stockAttributesCellEdit,
.stockAttributesCellDelete {
	border-bottom: 1px dotted #ccc;
}

This mod served my purposes so if any of you would like to take it any further, such as output this info to orders and or shopping cart or make the Attribute SKU editable via the admin please do so

8 Sep 2009, 9:41 PM
#3
ryanb4614 avatar

ryanb4614

Totally Zenned

Join Date:
Feb 2008
Posts:
556
Plugin Contributions:
0

Re: Modding Stock by Attribute to have SKUs / Model Number

Is this working? Has it been tested?

2 Nov 2009, 2:15 AM
#4
dkhoward avatar

dkhoward

New Zenner

Join Date:
May 2009
Posts:
15
Plugin Contributions:
0

Re: Modding Stock by Attribute to have SKUs / Model Number

Has there been any change or new information on these mods. I desperately need to be able to attach model numbers/SKU by attribute rather than to simple product description.

Help Please!