Jump to content
Sign in to follow this  
toasty

Attribute Sets Plus

Recommended Posts

Guys,

 

After reading 15 pages of code fixes can we please have an updated version posted online as it's almost impossible to work via the forum.

 

I have a problem with the options not appearing with the product info which i believe has been fixed in the forum but not via the contrib. Can thie be documented in the contrib properly rather than hack away at a very complexed set of 15 forum code changes.

 

Personally I've spent over 3 months adding addon's and tweeking the oscommerce app, I dont want this addon to cost me another 3 months to try and fix.

 

Scologic

 

Hello Mark

 

Welcome to the world of Open Source.

If you would like to contribute to the ASP contrib then your time would be gratefully received.

I no longer work on this contribution (because it works) except when I can help out without effecting other projects. Have you considered the time others put into creating what you have downloaded? I have nothing to gain here so what's with the 'guys do this and that?'

I think you will find that actually there are only one or two very small tweaks in this forum. If you do find a 'fix' for your issue 'that can be explained' then I would happily document it; but most seem to get it working without to much of a problem and I am not aware of an explained 'issue' with an identified fix than can be incorporated into the contrib.

 

I suspect this issue is to do with installation or a local setting (like languages - remember this is not yet multi-lingual friendly and osC has three languages on by default) and/or some other contribution interfering. Make sure you have only one language enabled. If you have other languages enabled and set it to one language after creating options then you need to remove the other language data from the database (or delete the options and re-create). Just a thought that might help.

 

osCommerce is not very 'module' friendly so it is a complex job to make it work the way you want it - but hey; its free and there's nothing else that can touch it - even now.

 

Final thought - when you get this properly installed it makes your life a lot easier!...oh; ....it took me three montrhs when I started out - consider it the learning curve.

 

regards

Chris.

Share this post


Link to post
Share on other sites

This was one of the first contributions that I researched and installed. Went like a dream, and I have never looked back. Bless you for such an amazing and on target contribution :D

But of course I have stumbled into a problem. I decided to install Header Tags Controller, and they are vying for the same space in admin/categories.php and I am completely at a loss on how to make these two work together. Is there an easier header tags contribution to install alongside? I refuse to give up my attributes plus! Even if I must forgo any header tags!

If someone could help me merge these two, my problems start in admin/categories.php with:

 

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");

// >>>> BOF Linkmatics attribute sets plus(2 of 5) calling custom function - update product - Begin

$arr_pas = array();

$arr_remove_sets = array();

for( $i=0; $i<$_POST['AttributeSetCount']; $i++ ){

$arr_pas[$i] = $_POST["products_attributes_sets_id_".$i];

 

and header tags wants to do this:

 

//HTC BOC

$sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),

'products_description' => tep_db_prepare_input($HTTP_POST_VARS['products_description'][$language_id]),

'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id]),

'products_head_title_tag' => ((tep_not_null($HTTP_POST_VARS['products_head_title_tag'][$language_id])) ? tep_db_prepare_input($HTTP_POST_VARS['products_head_title_tag'][$language_id]) : tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id])),

'products_head_desc_tag' => ((tep_not_null($HTTP_POST_VARS['products_head_desc_tag'][$language_id])) ? tep_db_prepare_input($HTTP_POST_VARS['products_head_desc_tag'][$language_id]) : tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id])),

'products_head_keywords_tag' => ((tep_not_null($HTTP_POST_VARS['products_head_keywords_tag'][$language_id])) ? tep_db_prepare_input($HTTP_POST_VARS['products_head_keywords_tag'][$language_id]) : tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id])));

//HTC EOC

 

Would appreciate any advice -


learn...love...laugh...live

Share this post


Link to post
Share on other sites

Hello,

 

Been using this contrib for a while and it really works great - thanks!!

 

One thing, don't know if I did something wrong but why don't the additional attributes show up in the order confirmation email?

 

How do I do this?

 

TIA

Share this post


Link to post
Share on other sites
Hello,

 

Been using this contrib for a while and it really works great - thanks!!

 

One thing, don't know if I did something wrong but why don't the additional attributes show up in the order confirmation email?

 

How do I do this?

 

TIA

 

ASP only alters how you administer your attributes (and perhaps the order of presentation on the catalog product page). The order talking (and storage of orders etc) is all standard osC functionality.

 

In other words if you are seeing your attributes OK and placing the order then it is osC code that is running, not ASP specific code. The only place you actually use ASP code is in the Admin interface. That's the beauty of ASP - it is standard osC for the catalog side of business.

Share this post


Link to post
Share on other sites

acharme

 

I had a very quick look and as it happens I have a site with both (ASP + HTC) installed. I think this is like for like (ie exactly what you need!) but I have other things installed and it is a customised site; so check through it before you paste it in.

 

This is the section from categories.php for the case update product section which seems to match what you pasted.

(Note: This site's code for ASP may not be an 'exact' match with the released code, but I think it will be!)

(Please let us know if it works as others may like to know too!)

Here you go:

 

elseif ($action == 'update_product')

{

$update_sql_data = array('products_last_modified' => 'now()');

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");

// >>>> BOF Linkmatics attribute sets (2 of 5) calling custom function - update product - Begin

$arr_pas = array();

$arr_remove_sets = array();

for( $i=0; $i<$_POST['AttributeSetCount']; $i++ ){

$arr_pas[$i] = $_POST["products_attributes_sets_id_".$i];

if( $_POST["remove_products_attributes_sets_id_".$i] == "on" ){

$arr_remove_sets["remove_products_attributes_sets_id_".$i] = $_POST["products_attributes_sets_id_".$i];

}

else {

$arr_remove_sets["remove_products_attributes_sets_id_".$i] = -1;

}

}

jjg_db_attributeSets( $arr_pas, $products_id, $action, $arr_remove_sets );

 

// <<<< EOF Linkmatics attribute sets - calling custom function - update product - End

 

}

 

$languages = tep_get_languages();

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

$language_id = $languages[$i]['id'];

//HTC BOC

$sql_data_array = array('products_name' => tep_db_prepare_input($_POST['products_name'][$language_id]),

'products_description' => tep_db_prepare_input($_POST['products_description'][$language_id]),

'products_url' => tep_db_prepare_input($_POST['products_url'][$language_id]),

'products_head_title_tag' => tep_db_prepare_input($_POST['products_head_title_tag'][$language_id]),

'products_head_desc_tag' => tep_db_prepare_input($_POST['products_head_desc_tag'][$language_id]),

'products_head_keywords_tag' => tep_db_prepare_input($_POST['products_head_keywords_tag'][$language_id]));

//HTC EOC

 

if ($action == 'insert_product') {

$insert_sql_data = array('products_id' => $products_id,

'language_id' => $language_id);

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);

} elseif ($action == 'update_product') {

tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");

}

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('categories');

tep_reset_cache_block('also_purchased');

}

 

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));

}

break;

Share this post


Link to post
Share on other sites

I get this in the products_attributes page in the admin:

1064 - You have an error in your SQL syntax near 'MAX_ROW_LISTS_OPTIONS' at line 1
select * from products_options where language_id = '1' order by products_options_id LIMIT 0, MAX_ROW_LISTS_OPTIONS
[TEP STOP]
HEADING_TITLE_OPT	  
>>

 

Does anyone know off hand what went wrong?

 

I double-checked step 6, nothing wrong. I'm now seeing double.

Share this post


Link to post
Share on other sites
I get this in the products_attributes page in the admin:

1064 - You have an error in your SQL syntax near 'MAX_ROW_LISTS_OPTIONS' at line 1
select * from products_options where language_id = '1' order by products_options_id LIMIT 0, MAX_ROW_LISTS_OPTIONS
[TEP STOP]
 HEADING_TITLE_OPT	  
>>

 

Does anyone know off hand what went wrong?

 

I double-checked step 6, nothing wrong. I'm now seeing double.

 

Hi

It's hard to tell what is going on from your post; it does not look right all - my hunch would be you have a messed up products_attributes.php. Try going to a back up file and doing it again.

 

If that does not work paste the entire error message here AND the URL from the address bar - but please try it again first because it is very likely to be this is an editing issue here.

cheers

Chris.

Share this post


Link to post
Share on other sites

I originally uploaded this page provided in the mod:

/catalog/admin/includes/languages/english/products_attributes.php

 

It had made the revisions to the code at the beginning of the page. However, when I moved this code to the bottom of the page, per the instructions, it fixed everything:

/* BOF Linkmatics attributes sets */
define('TABLE_HEADING_OPT_SORT_ORDER', 'Sort Order');
/* EOF Linkmatics attributes sets */

Add this line (before the '>?' at the end of the file)

 

...(or replace existing file with included file):<-THIS DID NOT WORK!!

Edited by tammyblalock

Share this post


Link to post
Share on other sites

Hello, i'm new to oscommerce.

 

We want to sell clothes in our shop, therefore i've installed your Attribute Sets Plus that i can easely set the sizes like "S, M, L, XL". It works perfect.

 

Now i have another Problem. If i want to set a stockvalue for each Produk and it's sizes. Is there a possibility to do this? Or do i need anothere Contribution?

Which contribution does work with your contribution?

 

Example:

I have a t-shirt in size L and M. I have 9 of them 5 L and 4 M.

At the moment i can only set the stockvalue to 9 for this product. What i want is to set it for t-shirt M to 5 and for t-shirt L to 4.

 

I hope you can give me a hint for that...

 

thanks

chris

Share this post


Link to post
Share on other sites

toasty,

 

I am busy trying to get my test server up to speed with the website, and then I will try your code. Thankyou so much for taking the time to post it, can't wait to see it work! I will post back so someone else will know if it works...


learn...love...laugh...live

Share this post


Link to post
Share on other sites

Okay - another glitch.

 

Mod is installed and seems to work fine.... until you look at the catalog.

 

http://www.papajimsbotanica.com/catalog1/p...roducts_id/7788

 

The options drop downs are empty, both if an item had existing options and if an attribute set was applied to the product.

 

Any help to solve this mystery would greatly be appreciated.

 

Thanks in advance.

Share this post


Link to post
Share on other sites
Okay - another glitch.

Mod is installed and seems to work fine.... until you look at the catalog.

http://www.papajimsbotanica.com/catalog1/p...roducts_id/7788

The options drop downs are empty, both if an item had existing options and if an attribute set was applied to the product.

Any help to solve this mystery would greatly be appreciated.

Thanks in advance.

 

 

Found this post by:

reihtec

 

on:

Dec 28 2005, 02:29 PM

 

Fixed the problem!! Thanks to all contibutors for a great mod!! :)

Share this post


Link to post
Share on other sites

Hi all.

I have serious doubt with the entire attributes system.

 

in my shop, each product has about 25 attributes. Some of them have up to 30 options (i am not creazy, i am selling prescription lenses!)

 

Now, because the system the way it is now make me save EACH option for EACH attributes for EACH product, my attributes table has about 260 options for each product. is already about to blow.

 

according to my understanding of the problem, i should build a template of attributues(and related options) then apply it to the selected articles.

so i shouldnt have a product_to_attributesOptions any more, but a product_to_template only.

 

when i display product_info.php i should load all the information related to the product + all the attributes in the linked template. thats it.

 

I am wrong? am i missing any important information in my logic?

 

please advice on this. Please let me know if any one has worked on this before.

thanks


Expresionario.com | Pura Sub-cultura!

Share this post


Link to post
Share on other sites
Hi all.

I have serious doubt with the entire attributes system.

 

in my shop, each product has about 25 attributes. Some of them have up to 30 options (i am not creazy, i am selling prescription lenses!)

....<snip>........please advice on this. Please let me know if any one has worked on this before.

thanks

 

Well if I had, wouldn't that make me a competitor?

Share this post


Link to post
Share on other sites
Well if I had, wouldn't that make me a competitor?

Oops, hit the send button too soon.

 

Yes I have this and a lot more, including an entire stock management system for glasses and lenses including automatic updates for the entire osC stock in one hit.

 

If you wish to discuss further I suggest to PM me and we'll take it off line.

 

regards

Chris.

Share this post


Link to post
Share on other sites

Hello

I need some help to this excellent contribution which hopefuly will save me a lot of time.

I installed as per instructions . From the admin section clicked on Attributes sets and get the following error.

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/www/avv-design.com/admin/includes/functions/database.php:13) in /home/www/avv-design.com/admin/includes/functions/database.php on line 13

[/b]

My database.php on line 13 and after reads as below

 

function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {

global $$link;

 

if (USE_PCONNECT == 'true') {

$$link = mysql_pconnect($server, $username, $password);

} else {

$$link = mysql_connect($server, $username, $password);

}

 

if ($$link) mysql_select_db($database );

 

return $$link;

}

 

function tep_db_close($link = 'db_link') {

global $$link;

 

return mysql_close($$link);

 

 

Any suggestions ?

 

Thanks

 

Vas

Share this post


Link to post
Share on other sites
Hello

I need some help to this excellent contribution which hopefuly will save me a lot of time.

I installed as per instructions . From the admin section clicked on Attributes sets and get the following error.

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/www/avv-design.com/admin/includes/functions/database.php:13) in /home/www/avv-design.com/admin/includes/functions/database.php on line 13

[/b]

My database.php on line 13 and after reads as below

 

Your error is more likely to be in the calling file which (if you look at your url) is probably <yourdomain>/..../admin/products_attributes_sets.php

As this is a file supplied by the contrib so I suggest it may be corrupt. Try downloading again and reinstall this file to see if that helps.

 

cheers

Chris.

Share this post


Link to post
Share on other sites

technical trouble - ignore this bit!

Edited by toasty

Share this post


Link to post
Share on other sites
Your error is more likely to be in the calling file which (if you look at your url) is probably <yourdomain>/..../admin/products_attributes_sets.php

As this is a file supplied by the contrib so I suggest it may be corrupt. Try downloading again and reinstall this file to see if that helps.

 

cheers

Chris.

 

Hello Chris

Thanks for the quick reply.

I did re-upload a fresh downloaded version of products_attributes.php and still get the same error.

I do not have any other contribs except Easy populate and yours. Everything else seems to be working OK.

Any other suggestions?

Thanks

 

Vas

Share this post


Link to post
Share on other sites
Hello Chris

Thanks for the quick reply.

I did re-upload a fresh downloaded version of products_attributes.php and still get the same error.

I do not have any other contribs except Easy populate and yours. Everything else seems to be working OK.

Any other suggestions?

Thanks

 

Vas

 

Not from what I can see. What is happening (apparently) is that the function <tep_db_connect> is being called more than once. I can't see why this is so from what you have told me.

Suggestions: Do you have any more error details or is that it?

It may be quicker to go to back up (pre ASP install) and re-install from scratch. I know that's a pain but this sort of problem is most likely to be a fundamental editing error of some sort.

Share this post


Link to post
Share on other sites
Not from what I can see. What is happening (apparently) is that the function <tep_db_connect> is being called more than once. I can't see why this is so from what you have told me.

Suggestions: Do you have any more error details or is that it?

It may be quicker to go to back up (pre ASP install) and re-install from scratch. I know that's a pain but this sort of problem is most likely to be a fundamental editing error of some sort.

 

Hello Chris

Thanks for reply

Bellow is the original error message I got before some changes I was doing with database.php

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in C:\wamp\www\avv-design\admin\includes\functions\database.php:13) in C:\wamp\www\avv-design\admin\includes\functions\database.php on line 25

 

Below is my database.php

 

(THIS IS LINE 13. ) function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {

global $$link;

 

if (USE_PCONNECT == 'true') {

$$link = mysql_pconnect($server, $username, $password);

} else {

$$link = mysql_connect($server, $username, $password);

}

 

if ($$link) mysql_select_db($database);

 

return $$link;

} ( THIS IS LINE 25 )

 

function tep_db_close($link = 'db_link') {

global $$link;

 

return mysql_close($$link);

}

 

After a few trials I get the original message I send you mentioning only line 13 and not line 25.

Does it make any sense as my coding is still a beginners

My server hasRegister Globals=On but I get the same exactly error working on my local Wamp server.

I did a brand new istall (downloaded again v1.01 ) on my local server from the begining and still get the same message. I could not uploaded to my server as my telephone line at home is down.

 

 

Thanks a lot

 

Vas

Share this post


Link to post
Share on other sites

hello Chris

Desregard my last post. I found the fault. I had copied the wrong products_attributes_sets.php into admin/includes/languages/english/

I now have another problem but I will try and search through the forum as I think I have seen the same remarks somewhere.

Thanks again

Vas

Share this post


Link to post
Share on other sites

Hi,

 

This is a great contribution but I'm having an issue displaying the attributes.

 

Everything looks good in the admin panel but the display shows nothing on product_info.php.

<td class="main">Size:</td>
<td class="main"><select name="id[2]"></select></td>

 

Also, I tried to apply a single attribute without using attribute set and the same issue occured.

 

This is the code I had, which correctly displays the attributes:

 

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

 

This is what I'm trying to replace it with:

 

 // BOF Linkmatics attributes sets plus								  
	  $products_options_query = tep_db_query("
	  SELECT pov.products_options_values_id, pov.products_options_values_name, 
		   pa.options_values_price, pa.price_prefix , pase.sort_order
		  FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . 
				TABLE_PRODUCTS_ATTRIBUTES_SETS_TO_PRODUCTS . " pas2pa, " . 
				TABLE_PRODUCTS_ATTRIBUTES_SETS . " pas, " .
				TABLE_PRODUCTS_ATTRIBUTES_SETS_ELEMENTS . " pase, " .
				TABLE_PRODUCTS_OPTIONS_VALUES . " pov
				WHERE	  pa.products_id = '" . (int)$_GET['products_id'] . "'		   
			AND pa.options_id = '" . $products_options_name['products_options_id'] . "'
			AND pas2pa.products_id = pa.products_id
			AND pas.products_attributes_sets_id = pas2pa.products_attributes_sets_id
			AND pas.products_options_id = pa.options_id
			AND pase.products_attributes_sets_id = pas.products_attributes_sets_id
			AND pase.options_values_id = pa.options_values_id
			AND pov.products_options_values_id = pa.options_values_id
			AND pov.language_id = '" . $languages_id . "'
			ORDER BY pase.sort_order, pa.options_values_id"); 
				 // >>>>> BOF Linkmatics attributes sets plus patch v1.01
	   if (tep_db_num_rows($products_options_query)== 0 ) {
				   $products_options_query = tep_db_query("
		   SELECT pov.products_options_values_id, pov.products_options_values_name,
				  pa.options_values_price, pa.price_prefix , pa.options_values_id
			 FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " .
					  TABLE_PRODUCTS_OPTIONS_VALUES . " pov
			 WHERE pa.products_id = '" . (int)$_GET['products_id'] . "'
			   AND pa.options_id = '" . $products_options_name['products_options_id'] . "'
			   AND pov.products_options_values_id = pa.options_values_id
			   AND pov.language_id = '" . $languages_id . "'
			 ORDER BY pa.options_values_id");
	   }
	  // <<<<< EOF Linkmatics attributes sets plus patch v1.01	  
	  // EOF Linkmatics attributes sets plus

 

Any ideas?

 

Thanks

Share this post


Link to post
Share on other sites

Hi peeps,

 

I have just installed the Options as Images MS2 contribtuon which allows me to show my product options/attributes as images. The only thing that is a problem for me is that the options are all shown as radio buttons, and I have a lot of options for each product and its starting to look messy as they are all shown at once. I have found that this contribution can be used with the options as images contribution, but before I go ahead and make the changes would the combination of the two contributions allow me to do the following: when an item is selected in the drop down menu the relevant picture is displayed for that option? I'm not really sure if this is what this contribution is aimed at achieving?

 

Any help would be fantastic.

 

regards Jonathan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×