Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problems with Product Attributes Sort Order


rgplanet

Recommended Posts

Yes, install the multiple cloner option.

 

Scott

 

Thank you Scott for such a quick reply.

 

I quickly looked through the install directions of v1.8.1.

 

I'm not clear as to what part is just for the clone option. Would I be better off just installing the complete mod?

- :: Jim :: -

- My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -

Link to comment
Share on other sites

Guys, I need some help. I installed a mod on oscmax for updated product attributes. I got it to work fine in the ADMIN tool, BUT now the products in my site won't pull up. Everything looks fine on the site until you actually click on a product, then you get.

 

Warning:mysql_fetch_array(): supplied argument is not a valid MySQL results resource in /home/sportsti/public_html/includes/functions/database.php on line 101

 

FYI, line 101 is " return $result;"

 

I didn't make any changes to database.php

 

Please help. I don't know what I did wrong.

 

the site is www.sportstickies.com

 

Thanks

Link to comment
Share on other sites

Hello,

 

I've installed the 1.8.1 version but I still get an error when trying to clone

 

This is the error:

 

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''+)' at line 1

 

INSERT INTO products_attributes ( products_id, options_id, options_values_id, options_values_price, price_prefixt) VALUES (47, 1, 3, 12.0000, '+)

 

[TEP STOP]

 

 

Can anybody help me?

 

Thanks in advance

Great contribution! Until this morning, I didn't realise that Product Attributes didn't list in the order in which you enter them - quite problematic when you have a dozen or so different sizes of shoe to list! The actual listing in the correct order is working very well, but with many, many pairs of shoes sharing the same information, I was pleased to see the clone function. However, I too am getting the exact same error above when trying to clone a set of attributes. I had hoped that the spelling of price_prefixt was the cause, but amending that didn't work.

 

I tried removing the prefix +, but that just bought up a different error. This would be a perfect Add-on if I can get this part working.

Link to comment
Share on other sites

Great contribution! Until this morning, I didn't realise that Product Attributes didn't list in the order in which you enter them - quite problematic when you have a dozen or so different sizes of shoe to list! The actual listing in the correct order is working very well, but with many, many pairs of shoes sharing the same information, I was pleased to see the clone function. However, I too am getting the exact same error above when trying to clone a set of attributes. I had hoped that the spelling of price_prefixt was the cause, but amending that didn't work.

 

I tried removing the prefix +, but that just bought up a different error. This would be a perfect Add-on if I can get this part working.

I just dragged the products_attributes.php that came with the installation, which has just the single clone feature, and that works like a dream, so there is somethiing wrong in the mult-clone version. That is as far as I can think, though!

Link to comment
Share on other sites

I just dragged the products_attributes.php that came with the installation, which has just the single clone feature, and that works like a dream, so there is somethiing wrong in the mult-clone version. That is as far as I can think, though!

 

thanks for that - that is helpful info - I did test it, but I don't use that version - I'll look into it.

 

Scott

Link to comment
Share on other sites

thanks for that - that is helpful info - I did test it, but I don't use that version - I'll look into it.

 

Scott

With DiffMerge it seems that the only thing I can see different that may affect it is that the attribute_sort references are missing - I just manually added them to the multi-clone product_attributes.php version and it now seems to work. But I will of course wait until the clever people tell me what really is wrong - because I am just guessing it - but enjoying myself at the same time!

 

I am awe of you people writing these contributions!

Link to comment
Share on other sites

that is the problem - I'll fix it and get an updated version out...

 

Scott

Link to comment
Share on other sites

Quick Question:

 

Does the Sort order and Clone contribution have ANY bearing on the price that is put into the cart ?

 

I have a problem where the attribute product price is being deducted from the BASE price of the product and I am not sure where the error is occurring.

 

I also have Actual Attribute Price 1.6 installed and the prefix +/- removed from my attributes section in Admin so there is no confusing when entering new products.

 

 

Any help would be appreciated.

 

 

Chris

Link to comment
Share on other sites

BUG !

 

After testing this contribution I have found that if multiple attributes are used for a single product and the price is not the same as the base price, the attribute price is deducted from the base price.

 

ie:

 

Tshirt Base price entered into the net price field when the product is created 9.99

 

Color: Black

Red

Green

 

 

Size: S (9.99)

M (12.99)

L (14.99)

 

If the customer chooses RED color and L size the price in the cart will be 5.00 and NOT 14.99 as it should be.

 

 

This bug only presents itself when the product as more than one option.

 

 

Has anyone found a fix for this ? I am assuming the blank price associated with the COLOR in this case defaults to a - in the prefix field.

 

 

Chris

Link to comment
Share on other sites

Hey Chris,

 

Was your attributes working correctly before the addition of the Clone contribution?

 

Just trying to determine if all worked well with - Actual Attribute Price 1.6 and the prefix +/- removed.

 

I have Actual Price in Pull down Option Menu v1.2.3a and Sort Product Attributes v1.2 installed and working.

 

But I am holding off adding the clone mod as it sounds not quite ready for primetime.

- :: Jim :: -

- My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -

Link to comment
Share on other sites

Hi Jim,

 

I already had actual attribute price v1.5 installed and working without a problem on the site before I installed Attribute Sort with Attribute Clone 1.81. This is where the problem started. I do not use the cloning tool as it create an SQL error.

 

 

 

Chris

Link to comment
Share on other sites

just posted an update for the multiple attribute cloner - 1.8.2 - could someone install it and message me to troubleshoot?

 

Scott

Link to comment
Share on other sites

just posted an update for the multiple attribute cloner - 1.8.2 - could someone install it and message me to troubleshoot?

 

Scott

 

Just looking over the code you're missing , ".$attributes_values['attribute_sort']." at the end of the insert statement of the multicopy

 

Also looking over the multi product copy it appears the logic may be flawed, from the variable names ($multi_clone_products_id_to) it looks like you're store multiple product ids! Really you should be storing one product id and copying to one product id. You should have some sort of while loop that runs sees how many product options values the product attribute has and the while loops inserts duplicates of the product option values into the new product id, multiple product ids should not be involved at all. I don't really know how to implement this, but I'm pretty sure that's how it would be done??

Edited by homewetbar

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

Thanks - I can add that piece - don't know about the rest... maybe someone who will use it will further develop that aspect of this addon.

 

Scott

Link to comment
Share on other sites

Ok I've tested both the single product copy and the multiple product copy and they both appear to be working beautifully! Nice easy to follow install directions too!

 

Thank you for the great contribution!

 

A few suggestions:

1) The difference between the single and multi copy is unclear, I actually thought single copy would just copy one attribute until I tried it. Maybe a better description of the two would be single product copy or multiple product copy.

 

2) There needs to be some sort of logic to prevent you from accidently putting the same product in the both the copy to and from fields (which ends up deleting the product)

To fix this simply add:

// BOE: Attribute Sort with Clone Tool
  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'];
	if ($clone_product_id_from != $clone_product_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;
// EOE: Attribute Sort with Clone Tool
// Delete products addon 3/9/2009
  case 'delete_product_attributes':
  	$delete_attributes_products_id = $HTTP_POST_VARS['delete_attributes_products_id'];
  	tep_db_query("delete from ".TABLE_PRODUCTS_ATTRIBUTES." WHERE products_id='".$delete_attributes_products_id."'");
  	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
  	break;

 

At the end of code after:

<tr>

<td colspan="8"><?php echo tep_black_line(); ?></td>

</tr>

</table></form></td>

</tr>

 

Insert instead of clone tool original code:

<!-- BOE: Attribute Sort with Clone Tool //-->
<tr><td>
    	<?php
  echo '<form name="clone" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=clone_attributes', 'NONSSL') . '" method="post">';
?>
<Table  bgcolor="dfefde">
<!-- Data Start -->
       <tr bgcolor="dfefde"><td class="pageHeading">Clone Product Attributes</td></tr>
<tr bgcolor="dfefde">
<td class="main" valign="top"><b>From:</b>
<select name="clone_products_id_from">
<?php
$products = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' order by pd.products_name");
while ($products_values = tep_db_fetch_array($products)) {
echo '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '">' . $products_values['products_name'] . ' [#' . $products_values['products_id'] . ']</option>';
}
?>
</select></td>
<td class="main" valign="top"><b>To:</b>
<select name="clone_products_id_to">
<?php
$products = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' order by pd.products_name");
while ($products_values = tep_db_fetch_array($products)) {
echo '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '">' . $products_values['products_name'] . ' [#' . $products_values['products_id'] . ']</option>';
}
?>
</select>
</td><td><?php echo tep_image_submit('button_copy_to.gif', 'Copy To'); ?> (Click once to copy)</form></td></tr>
<tr><td>
</td></tr>
</table>
</td></tr>

<tr><td>
    	<?php
  echo '<form name="delete_attributes" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_product_attributes', 'NONSSL') . '" method="post">';
?>
<tr><td>
<br><br>
</td></tr>
<!-- Delete products addon 3/9/2009 //-->
<Table  bgcolor="f0d0d0">
<!-- Data Start -->
       <tr bgcolor="f0d0d0"><td class="pageHeading">Delete all attributes for Product</td></tr>
<tr bgcolor="f0d0d0">
<td class="main" valign="top"><b>From:</b>
<select name="delete_attributes_products_id">
<?php
$products = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' order by pd.products_name");
while ($products_values = tep_db_fetch_array($products)) {
echo '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '">' . $products_values['products_name'] . ' [#' . $products_values['products_id'] . ']</option>';
}
?>
</select>
</td><td><?php echo tep_image_submit('button_delete.gif', 'Delete'); ?> (Click to delete)</form></td></tr>
<tr><td>
</td></tr>

</table>
</td></tr>
<!-- EOE: Attribute Sort with Clone Tool //-->

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

Hi hope some one can help, the sort order can be altered in admin in the product edit but this does not allow them the products to be displayed in the correct order when it comes to the website page.

 

 

Is there anyway to set this please so that the order seen in product edit is the order they display on the website shop

 

Thanks

Johnny

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

If your talking PRODUCTS I delt with that in this thread http://www.oscommerce.com/forums/index.php?sho...c=308798&hl=

 

 

If atributes look in tips too

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Hi,

 

I'm not sure if Scott or Erik should be addressed but I found some inconsistencies in the fileset and a sort problem with "Attribute Sort with Attribute Clone 1.8.3"

 

First, the instructions such as [*** If you want to clone all attributes from ONE Product Attribute to ONE Option Value, insert the following ***] were not clear as to whether the option was one or the other or an all you can eat type setup choice. If I wanted all the functions could I install all the options or did it have to be one or the other?

 

------------------------

CATALOG\PRODUCT_INFO.PHP

------------------------

The ASWAC1.8.3 paragraph below calls for an "order by attribute_sort" but the paragraph before it calls for an "order by popt.products_options_name" and seems to be canceling out the clone tools call to "order". If I remove the first paragraphs sort call then clone tool will (almost) order the attributes by sort number. I say almost because no matter what I set the sort numbers to one of my attributes will not sort. I have an attribute set to "2" that refuses to move to the head of the selection even though the other attributes are set to 4, 6, and 8. When the sort is set to alphabetical, it orders perfectly. When sort is set to use the attribute sort, it moves to second place when it should be first.

=======================================

$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");

while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {

$products_options_array = array();

// 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)$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 attribute_sort");

// EOE: Attribute Sort with Clone Tool

========================================

 

 

-------------------------

CATALOG\ADMIN\PRODUCTS_ATTRIBUTES.PHP

-----------------------

 

Difference between the instructions and the fileset on lines 74 through 77. First line commented and moved in fileset but not in the instructions.

============================

// 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) . "')");

// 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

=================================

 

Difference between the instructions and the actual file on lines 131 through 134. First line commented and moved in fileset but not in the instructions.

===============================

// tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES . " set products_id = '" . (int)$products_id . "', options_id = '" . (int)$options_id . "', options_values_id = '" . (int)$values_id . "', options_values_price = '" . (float)tep_db_input($value_price) . "', price_prefix = '" . tep_db_input($price_prefix) . "' where products_attributes_id = '" . (int)$attribute_id . "'");

// BOE: Attribute Sort with Clone Tool

tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES . " set products_id = '" . (int)$products_id . "', options_id = '" . (int)$options_id . "', options_values_id = '" . (int)$values_id . "', options_values_price = '" . (float)tep_db_input($value_price) . "', price_prefix = '" . tep_db_input($price_prefix) . "', attribute_sort = '" . (int)$attributes_sort . "' where products_attributes_id = '" . (int)$attribute_id . "'");

// EOE: Attribute Sort with Clone Tool

===============================

 

My workaround for CATALOG\PRODUCT_INFO.PHP was to change the first call to order from "order by popt.products_options_name" to "order by popt.products_options_id". This was an awesome and needed contribution. Thanks to all keeping it updated.

 

Athena

Link to comment
Share on other sites

One other thing I have noticed when cloning product attirbutes the newest version randomly selects the order of the attributes to copy, not good if you want your attributes in a specific order like you had on the other product for displaying on the catalog side. To fix simply add in the product_attributes.php an order by statement like so: o rder by products_attributes_id here is the fixed line (near very top of changes):

 

$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."' order by products_attributes_id");

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

Has anyone installed "Product Attributes Sort Order and Clone" in combination with SPPC 4.2 ?

Because SPPC makes extra price groups which from which attribute price is not updated when using clone tool. Only attributes group ID=1 is updated..

Can someone help me with this issue. I assume it is change of query in products_attributes.php in ADMIN that is needed. But how? (I'm no php expert :()

Thanks in advance. (Let me know if someone needs more info.)

Link to comment
Share on other sites

  • 3 weeks later...
BUG !

 

After testing this contribution I have found that if multiple attributes are used for a single product and the price is not the same as the base price, the attribute price is deducted from the base price.

 

ie:

 

Tshirt Base price entered into the net price field when the product is created 9.99

 

Color: Black

Red

Green

 

 

Size: S (9.99)

M (12.99)

L (14.99)

 

If the customer chooses RED color and L size the price in the cart will be 5.00 and NOT 14.99 as it should be.

 

 

This bug only presents itself when the product as more than one option.

 

 

Has anyone found a fix for this ? I am assuming the blank price associated with the COLOR in this case defaults to a - in the prefix field.

 

 

Chris

 

 

Possible solution for this is for all the non-price attributes (eg black, green, red) use "+" prefix and value price "0.000". Leaving these fields blank will default to minus and use the base product price as the value price.

 

This is not a fix but a way around this problem.

Link to comment
Share on other sites

  • 1 month later...
Guys, I need some help. I installed a mod on oscmax for updated product attributes. I got it to work fine in the ADMIN tool, BUT now the products in my site won't pull up. Everything looks fine on the site until you actually click on a product, then you get.

 

Warning:mysql_fetch_array(): supplied argument is not a valid MySQL results resource in /home/sportsti/public_html/includes/functions/database.php on line 101

 

FYI, line 101 is " return $result;"

 

I didn't make any changes to database.php

 

Please help. I don't know what I did wrong.

 

the site is www.sportstickies.com

 

Thanks

 

I'm having exactly this problem also. Does anyone know the solution or at least the cause of it?

Link to comment
Share on other sites

I'm having exactly this problem also. Does anyone know the solution or at least the cause of it?

 

Nevermind, fixed it! Not quite sure what went wrong but there was an error with the catalog/product_info.php file. Rechecking the file, bringing it back to its original format and then carefully inserting the extra bit of code again fixed the problem.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...