Community Add-Ons
Product Attributes Sort Order v1.0
for osCommerce Online Merchant v2.2
Product Attributes are read out from the database and placed into a select box, however the top most attribute becomes the default, with no way to override or set the sort order of the options. This may result in a default item with a price different from the posted price.
Operating on the assumption that price modifiers should be specificaly selected by the user, this mod adds a sort_order field to the product_atributes table and to the products_attributes.php, and product_info.php pages to allow user ordering of these attributes.
Legend:
Download
Report
// BOE: Attribute Sort with Clone Tool
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$this->products_id . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by pa.options_values_price, pa.Products_attributes_id");
// EOE: Attribute Sort with Clone Tool
Problem solved with QT Pro and Product Attributes Sort Order
In catalog/includes/classes/pad_base.php
Find this:
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$this->products_id . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
REPLACE with this:
// BOE: Attribute Sort with Clone Tool
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$this->products_id . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by pa.options_values_price, pa.Products_attributes_id");
// EOE: Attribute Sort with Clone Tool
MikeySwede
Nice simple little contribution.
As default this contribution orders everything however It wants. Until you set the order ID they remain in an unorganised way.
This little mod will sort the attributes by price unless an option ID is entered.
If the option id is the same (to start they are all 0) then the lowest price attribute is displayed.
Tested with v1.8.x
All you are doing is adding "pa.options_values_price" at the end. Its saying if the attribute sort is the same then order by price.
I cant really take much credit for this. My inspiration came from the "Sorting Attributes" contribution from way back in 05
I hope it helps someone out.
DamanC aka Daman
====================================================
Open /catalog/product_info.php
Find:
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pa.attribute_sort");
Replace:
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pa.attribute_sort, pa.options_values_price");
====================================================
NOTE: This is not a complete package. The zip is actually a rar file (change the extension to .rar if you have a problem opening it) and contains only the text above!
GERMAN included
~duen
Hopefully multiple attribute cloner works now.
Scott
I think I fixed the Multiple Attribute Cloner. It would help me if someone could test it out and report the result to me as I do not use the multiple cloner.
Scott
FULL PACKAGE
Same as below; however, I forgot to apply my fix on the forum that you can find here: http://forums.oscommerce.com/index.php?s=&showtopic=327276&view=findpost&p=1363928
If you have the below package:
Find this:
tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values (null, '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . (float)tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "')");
REPLACE with this:
// BOE: Attribute Sort with Clone Tool
tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values (null, '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . (float)tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "', '" . (int)$attributes_sort . "')");
// EOE: Attribute Sort with Clone Tool
Scott
FULL PACKAGE
Product Attributes are read out from the database and placed into a select box, however the top most attribute becomes the default, with no way to override or set the sort order of the options. This may result in a default item with a price different from the posted price. Operating on the assumption that price modifiers should be specifically selected by the user, this addon adds a sort field to the product_atributes table, products_attributes.php, and product_info.php pages to allow user ordering of these attributes.
The Product Attribute Clone Tool is included: http://addons.oscommerce.com/info/4550
Support Forum: http://forums.oscommerce.com/index.php?showtopic=68003
Since v1.7
----------
* Reformatted instructions
* Added database query file
* Removed extra, unnecessary database entry
* Added the multiple attribute clone option
* English and French included
Scott
Version multi-langues (Anglais et Français)
Package complet
Installation en Français
Screenshots inclus
Visible ici : http://www.oscommerce-screenshots.com/attributes-sort-order-with-attributes-clone-p-237.html
***********************************************************************
Version multi-languages (English and French)
Full Package
Installation in French
Screenshots included
Visible here: http://www.oscommerce-screenshots.com/attributes-sort-order-with-attributes-clone-p-237.html
In the file admin/products_attributes.php
Bug is fixed to clone products attributes
Find:
case 'clone_attributes':
$clone_product_id_from = $HTTP_POST_VARS['clone_products_id_from'];
$clone_product_id_to = $HTTP_POST_VARS['clone_products_id_to'];
tep_db_query("delete from ".TABLE_PRODUCTS_ATTRIBUTES." WHERE products_id='".$clone_product_id_to."'");
$attributes = tep_db_query("select products_id, options_id, options_values_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES ." where products_id='".$clone_product_id_from."'");
while($attributes_values = tep_db_fetch_array($attributes)) {
tep_db_query("INSERT INTO " . TABLE_PRODUCTS_ATTRIBUTES . " ( products_id, options_id, options_values_id, options_values_price, price_prefix ) VALUES (".$clone_product_id_to.", ".$attributes_values['options_id'].", ".$attributes_values['options_values_id'].", ".$attributes_values['options_values_price'].", '".$attributes_values['price_prefix']."')");
}
break;
Replace with:
case 'clone_attributes':
$clone_product_id_from = $HTTP_POST_VARS['clone_products_id_from'];
$clone_product_id_to = $HTTP_POST_VARS['clone_products_id_to'];
tep_db_query("delete from ".TABLE_PRODUCTS_ATTRIBUTES." WHERE products_id='".$clone_product_id_to."'");
$attributes = tep_db_query("select products_id, options_id, options_values_id, options_values_price, price_prefix, attribute_sort from " . TABLE_PRODUCTS_ATTRIBUTES ." where products_id='".$clone_product_id_from."'");
while($attributes_values = tep_db_fetch_array($attributes)) {
tep_db_query("INSERT INTO " . TABLE_PRODUCTS_ATTRIBUTES . " ( products_id, options_id, options_values_id, options_values_price, price_prefix, attribute_sort) VALUES (".$clone_product_id_to.", ".$attributes_values['options_id'].", ".$attributes_values['options_values_id'].", ".$attributes_values['options_values_price'].", '".$attributes_values['price_prefix']."' , ".$attributes_values['attribute_sort'].")");
}
tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
break;
That's all.
Full Package is included.
(The file(products_attributes) is concordant with version RC2a.)
(Products Attributes Sort Order + Products Attributes Clone Tool)
+Working Perfect...
Notice: if someone wants to install this manually, must check my previous packages
2 Updates for Product Attributes Sort Order v1.6
and
I fixed my 2 bugs in the /admin/products_attributes.php file of Product Attributes sort order v1.6 contribution which I added before.
Turkish
Product Attributes ile ilgili product_attributes.php dosyasini ilgilendiren onca contribution'a karsin , burdaki guncel versiyonlarda manual installation
dosyalarinin bulunmamasi buyuk kayip. Bende buna karsilik product attributes sort order contribution yuklemesi icin products_attributes.php sayfasindaki
tum degisiklikleri adim adim anlatan bir manual installation dosyasi olusturdum. (OsCommerce'nin son cikardigi oscommerce v2.2rc2a uzerinde denenmistir.)
v1.6 Degisiklikler
Bunun disinda eklemis oldugum admin/products_attributes.php (oscommerce v2.2rc2a icin) dosyasinda http://www.oscommerce.com/community/contributions,4550 sayfasindaki
bir diger products attributes'leri duzenlemenizde isine yarayabilecek bir contirbution olan "Product Attributes Clone tool" hazir halde install edilmistir.
product_info ve products_attributes.php sayfalarindan screenshots eklenmistir.
Eklemis oldugum admin/product_attributes.php dosyasi "product type option" icin uyarli oldugu icin product_type_option.sql dosyasindaki sql query'yi calistirilmasini gerektirir,
Bu sql query'nin calistirilmasi diger fonksiyonlarin calismasini etkilemez, sadece siralamadaki hatanin cikmasini onler boylelikle "product type option" install yapmis olan ya da install yapmis olmayan herkes kullanabilir.
English
Although there are many contributions related to Product Attributes in product_attributes.php file ,it is a big lost that there is
no manual installation on updated versions. So that to be able to install product attributes sort order contribution I created
a new manual installation file that shows and explains step by step all the changes in products_attributes.php page.
(It has been tested on last version of oscommerce v2.2rc2a)
v1.6 ChangeLog
Rather then this in admin/products_attributes.php file (for oscommerce v2.2rc2a) the http://www.oscommerce.com/community/contributions,4550 page which I added,
there is "Product Attributes Clone tool" has already been intalled which will help you to prepare other product attributies.
Screenshots has been added from product_info and products_attributes.php pages.The admin/product_attributes.php file
that I added is conformably to ''product type option'' so that it needs to run the sql query in product_type_option.sql file.
To run this sql query will not affect other fonctions it will only hide the error on listing to not be shown
so that everybody (who installed the ''product type option'' or who didn't install it) can use it.
Somente a correcção do products_atributes.php para quando der este erro:
1136 - Column count doesn't match value count at row 1
insert into products_attributes values ('', '91', '21', '122', '', '+', '1')
[TEP STOP]
versão traduzida para o português,não coloquei nenhum adicional apenas fiz a tradução e adicionei screenshoot que mostra o admin e mostra a product_info como será mostrado na loja
todos os créditos são dos caras abaixo eu apenas fiz a tradução
This is an update from v1.2. I just added a new function which sorts the attribs by its ID, this is the order in which they were made. Until now, it was just ordered by the product name, but the products which had many different attributes were a mess.
Now it's even easier to sort all attirbs! :D
This integrates Product Tabs 1.5 with Product Attributes Sort Order v.1.11
Product tabs 1.5 can be downloaded here: http://www.oscommerce.com/community/contributions,2610/category,all/search,product+tabs
Follow the installation then the updates for it if needed for your store
This is only the admin/categories.php file to make it easy to integrate these 2 contributions which, in my opinion, are a must for any site. This file will make installation easy as long as you have no other mods on the categories.php file.
Minor change, updated installation file and zip file contents.
Version 1.2 had everything you need to add a Attribute sorting box to your attributes area and only modifies attribute based files (with a few small changes to other files detailed in the installation intructions).
This contribution will no longer edit the new product based files as to not clash with product based contributions (like the product sorting contribution).
You gotta have the attribute sorting working...
All you have to do to make it work with options is find this line... "$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");" ... in the product_info.php file and replace it with ... "$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' group by patrib.attribute_sort order by patrib.attribute_sort");" ... now your options will use the same ordering as your attributes ... enjoy
First of all, the last 2 contributions below this do not belong here because they have nothing to do with the original contribution. They in fact belong here in Forrest Miller's contribution: http://www.oscommerce.com/community/contributions,1690/category,all/search,attr+sort
The contribution 29 Feb 2004 - Product Attributes Sort Order v.1.0.1 is nothing more than Forrest Miller's 28 Nov 2003 - Products Attributes Sort v1.0. The files are all exactly the same and are no improvement. Someone please delete this.
The contribution 24 Mar 2004 - Product Attributes Sort Order v.1.11 has an extra file and 2 different lines in the readme file, but all other files are identical to Forrest Miller's 28 Nov 2003 - Products Attributes Sort v1.0. Someone please move it there.
First, all credit to the original author and the people who've done such a great job cleaning and extending this product.
This mod builds on v1.0.1 by integrating code from the Alternative Attribute Manager (which I love) to provide a grid-based attribute manager at the bottom of the product entry/updating page. (categories.php)
This is a must for sites which are attribute heavy but use non-alphabetic sorting - in my client's case, clothing.
This module contains all the files from v1.0.1 plus the "categories.php" file.
I've tested this on my client's site, let me know if you find any problems!
All credit to the original author here. Just cleaned up a few things:
Made 1 or 2 changes in the install instructions;
Cleaned up provided files by starting with a "clean" OS2 MS2.2 install version, rather than original author's already well-loaded files :)
Basically, this package includes all the files you'll need to install the mod over a clean OSComm install. Will prevent problems with calls to functions and etc. that are not there.
Let me know if you have questions :) Great module! I love it!
V1.03 03/01/2004 Janis Carper and separately Jon Hillenbrand let me know about issues they experienced in the installation process which I have used to hopefully improve this installation
Mod: v1.02 01/31/2004 Corrected typo's in the instructions thanks to Jay Saeger
Added directions for editing product_info.php which were left out of the original release. This is a full re-release of the package, not an incremental update.
Product Attributes are read out from the database and placed into a select box, however the top most attribute becomes the default, with no way to override or set the sort order of the options. This may result in a default item with a price different from the posted price.
Operating on the assumption that price modifiers should be specificaly selected by the user, this mod adds a sort_order field to the product_atributes table and to the products_attributes.php, and product_info.php pages to allow user ordering of these attributes.
