Jump to content
Nimmit

AJAX Attribute Manager support

Recommended Posts

The Up\Down arrows works only if you have Attribute Sort Order plugin installed.

 

The above query sorts only options, not attributes. It sort by their names and applied only if two or more options available for the product.

There is one more query, that selects attributes. Like this on unmodified store:

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

 

Try to change it to

$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.options_values_price, pa.options_values_price, pov.products_options_values_name");

That code should sort by price and than, if equal prices, by attributes name. But this is not what you want if you have negative prices, because negative in that case be the first.

 

Thank you,

 

Is this the plug in for this manager that you recommend? http://addons.oscommerce.com/info/2673/v,22

 

If not can you direct me to the one you do recommend? Also if I use a plug in do I need to change this back to default code?

Share this post


Link to post
Share on other sites

This http://addons.oscommerce.com/info/1822 plugin is compatible with AJAX Attribute Manager. It has some enhanced functionality, but you may not install it or may be it is helpful for you. Please, don't forget to check AJAX AM install.htm in section "- Instructions for Sort Order Plugin" and do recommendations. My quick fix in previous post should be reverted back.

Nevertheless, now you know how to operate with sort order of you options and attributes. Hope you may decide yourself what way is better for you. ))

 

Regards,

Peter

Share this post


Link to post
Share on other sites

This http://addons.oscommerce.com/info/1822 plugin is compatible with AJAX Attribute Manager. It has some enhanced functionality, but you may not install it or may be it is helpful for you. Please, don't forget to check AJAX AM install.htm in section "- Instructions for Sort Order Plugin" and do recommendations. My quick fix in previous post should be reverted back.

Nevertheless, now you know how to operate with sort order of you options and attributes. Hope you may decide yourself what way is better for you. ))

 

Regards,

Peter

 

Thank you for your quick help. I really appreciate it. Maybe this will help someone else as well.

Share this post


Link to post
Share on other sites

This http://addons.oscommerce.com/info/1822 plugin is compatible with AJAX Attribute Manager. It has some enhanced functionality, but you may not install it or may be it is helpful for you. Please, don't forget to check AJAX AM install.htm in section "- Instructions for Sort Order Plugin" and do recommendations. My quick fix in previous post should be reverted back.

Nevertheless, now you know how to operate with sort order of you options and attributes. Hope you may decide yourself what way is better for you. ))

 

Regards,

Peter

 

Peter, first thank you for the QT Pro compatibility add on. I was not able get QT Pro to update quantities before and now the AJAX AM takes care of that.

 

Regarding the sort order matter, I seem to have run into a snag with this. In "Instructions for Sort Order Plugin" I found that I apparenly lose this section

 

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

 

after I do the QT Pro Install using a file compare application. Meaning the code begining with "$products_options_name_query ...." is over written after the install of QT Pro. Thus this part of the instruction I can not follow.

 

Here is what happens with the QT Pro in product_info.php

 

    $products_attributes_query = tep_db_query("select count(*) as total 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 . "'");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
//++++ QT Pro: Begin Changed code
     $products_id=(preg_match("/^\d{1,10}(\{\d{1,10}\}\d{1,10})*$/",$HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : (int)$HTTP_GET_VARS['products_id']); AND SO FORTH 

 

AS you see QT Pro overwrites the immediate section that sort manager wants to change.

 

I hope that is clear.

 

Comments please and thank you.


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

AS you see QT Pro overwrites the immediate section that sort manager wants to change.

 

I hope that is clear.

 

Comments please and thank you.

I see, but no matter to worry. I have my QT Pro with Sort Order works great.

Open file catalog\classes\pad_base.php, found

function _build_attributes_array($build_stocked, $build_nonstocked)

and in the body of it you see code that very close to you "lost". Simply add necessary sort order to queries around line 296 and 301.

Please note, I have highly modified store, so line numbers may be slightly different.

 

Fill free to ask for help.

 

Good luck!

Peter

Share this post


Link to post
Share on other sites

I didn't check, so it's on you own risk. Find function amUpdate (near line 103) in attributeManager.js and comment out line 110:

 

before:

if((optionSender=='prefix')&&((prefix=='')||(prefix==' '))){
	price='0';
}

 

after:

if((optionSender=='prefix')&&((prefix=='')||(prefix==' '))){
//		price='0';
}

hi thanks

 

it does not work. there is a script that forces (+) if any number is added for the price. i need to find how to disable this

 

any other ideas would be welcome

 

thanks

Share this post


Link to post
Share on other sites
Fill free to ask for help.

 

Good luck!

Peter

 

Peter, I located the piece of code in pad_base.php and changed it to:

 

      $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_track_stock from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$this->products_id . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' " . $stocked_where . " order by popt.products_options_sort_order");

 

I then set the sort order in products attributes for the first product and upon checking found the attribute was showing in DESCending order on the store site. The sort order was 0,1,2 and so on. What is interesting is that every subsequent product I cloned off the first one have their attribute displaying ASCending, which is correct. I wonder why just the first one is showing descending and not ascending? I even tried to force ascending by putting ASC in code "....popt.products_options_sort_order ASC"); but that didn't work for that first product that has it's attribute incorrectly descending.

 

Any ideas on that? and thank you.


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

Any ideas on that? and thank you.

 

Peter, disgard my previous post, I screwed up on of the piece of code that I needed to put in the "order by" text. Got it now and it's working fine.

 

Thanks again for your help.


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

hi,

hope some one can help me

i need to remove the forced (+) when adding attributes to a product. i need it to be (nothing).

the problem now is that when i make it nothing it automatically converts the attribute value to (0.00).

thanks in advance

valerif

hi,

for who would like to make this work see the solution below. thanks to the suggestions of 2 members of this forum that guided me to this solution

 

on approximately line 88 and 421 of attributeManagerInstant.class.php

 

change:

 

if((empty($prefix))||($prefix==' ')){

$prefix='+';

 

to:

 

if((empty($prefix))||($prefix==' ')){

$prefix='';

 

on line 134 of attributeManager.jsc

 

change:

 

if((price!='0.0000')&&((prefix=='')||(prefix==' '))){

setDropDownValue('prefix_'+optionValueId,'%2B','s');//+

}

 

to:

if((price!='0.0000')&&((prefix=='')||(prefix==' '))){

setDropDownValue('prefix_'-optionValueId,'%2B','s');//- }

 

cheers

Share this post


Link to post
Share on other sites

I hope someone can help please, i have set up all my products, then when i go on each product and use this app to load the template of sizes and prices i have saved, then go to the next product and do the same, if i edit the template on the next product and save it as template, it only saves the changes on that one product not all products on my website. ie the template is not loading on all my products that are using that template.

basically what im wanting is all my products to use the same template, then when want to change the Attributes such as size or price, but i only want to edit and save the template once, not go into each product and change them manually, will take forever!

 

is this possible?

 

thanks

Share this post


Link to post
Share on other sites

I hope someone can help please, i have set up all my products, then when i go on each product and use this app to load the template of sizes and prices i have saved, then go to the next product and do the same, if i edit the template on the next product and save it as template, it only saves the changes on that one product not all products on my website. ie the template is not loading on all my products that are using that template.

basically what im wanting is all my products to use the same template, then when want to change the Attributes such as size or price, but i only want to edit and save the template once, not go into each product and change them manually, will take forever!

 

is this possible?

 

thanks

 

hi. unfortunatly its not working that way. once you fetch a template for a product. it only copies the attributes to that one product. and thats it. if you alter the template. it only affects the products you add it to in the future. not those you added it to in the past.

 

if you want it the other way you need to alter the core way attributes is build up in some way.

Share this post


Link to post
Share on other sites

is this possible?

Everything is possible. But that logic you should do your self.

 

The main problem is how to assign templates to attributes and then loads and shows right attribute in hundreds places in the shop. I see 2 way to do:

1. You need change database to allow products store its attribute template ID. Then you need to modify AJAX AM to store template ID with product in new DB field. It is very simple yet. Now you should do workaround in every place in your shop where attributes used. You need modify them so, they used attributes from your stored template. It will be hard work! Moreover, every new plugin, report, etc. must be change according to your new attribute logic. Its incredible, bot possible.

 

2. As in previous, you should need to store template ID with product and modify AAM contrib to do that. Next after you modify template you should run a function, which walks throug all products with same template ID and replaces all attributes for each product making them identical to your template. This way is not so great, but you need to modify only AJAX AM contrib and other plugin will work as usual.

 

I hope, its clear. My English is bad :blush:

 

May be there are other ways. But all of this is not my job. You need the very "special" logic, may be somebody will help you. Good luck!

Share this post


Link to post
Share on other sites

Peter (RusNN) is right. and second option would be the best choice.

but if i were to do it i would dublicate the template function. not alter it. because it is usefull also. or at least set a flag in the template table to tell it its a global template.

 

i actually dont think its too hard to do. but i dont really see the point of multiple productes using the same attributes. why not convert the products to arrtibute instead.

well. perhaps you really need to do it that way with your kind of products. good luck creating the function. and please post it back to the community

 

Ps. peter my english is not good either. but thats not an issue. as long as we understand each other :)

Edited by mortal

Share this post


Link to post
Share on other sites

peter my english is not good either. but thats not an issue. as long as we understand each other :)

You are absolutely right! Cheers! :thumbsup:

 

 

Thank you for your replys, unfortunatly i have no idea how to do any of those suggestions. thank you anyway for your help.

Well... I am not a php programmer, but I can do QT Pro plugin to work. It will be slightly difficult, but not impossible. Can I do better, if I will know php better? Probably... but definitely less time to do. See into the code, you found everything there.

Share this post


Link to post
Share on other sites

Getting this error in the screen shot ?

Can any one help , everything is working except most of the options ( text ) are missing , how can i fix this thanks

 

error AJAX-AttributeManager-V2.8.8.JPG

Share this post


Link to post
Share on other sites

Getting this error in the screen shot ?

Can any one help , everything is working except most of the options ( text ) are missing , how can i fix this thanks

 

error%20AJAX-AttributeManager-V2.8.8.JPG

 

i had a simular problem, that some options will not show up in this addon, but were in products attributes and shown to the customer on the product_info.php page

 

after playing around a bit, i worked out what it was

 

lets say you got attribute A, & attribute B, (e.g. blue and white)

and attribute A is in option Z & option Y (e.g. size, colour)

and attribute B is only in option Z and not option Y

and you orginally put attribute A in option Z, it will show up in option Z but not option Y

 

so what i did, i added attribute A to option Y

which means i got a copy of

attribute a in option Z

and in option Y.

 

i tried to make this as generic as possible, which is why i used letters instead of actual examples

Share this post


Link to post
Share on other sites

ok thanks for you help on that , i see what you mean , the old attributes could be used with anything thing , but this setup they just dont show up

 

Ok thanks for taking the time to help ;)

Share this post


Link to post
Share on other sites

First of all thank for a very nice Contb.

 

I have installed the latest version.

I have a small problem that i cant fix.

When i expend the attributes in + or - i will be redirected to preview page. The same page that the button preview page redirects to.

 

So instead of showing all size like s.m.l.xl... i will be redirected to preview page.

Hope you get what i meen!

Share this post


Link to post
Share on other sites

First of all thank for a very nice Contb.

 

I have installed the latest version.

I have a small problem that i cant fix.

When i expend the attributes in + or - i will be redirected to preview page. The same page that the button preview page redirects to.

 

So instead of showing all size like s.m.l.xl... i will be redirected to preview page.

Hope you get what i meen!

Hmmm... Very strange. This part works for years and nobody report for problems. Are you shure you install contrib properly and there are no other scripts/contributions that may conflict with AJAX AM?

Share this post


Link to post
Share on other sites

I've just installed this contrib and I'm getting errors. It wants to track stock of the attributes. I haven't installed any add-ons to do that , so its giving me errors. On my product info page, when I'm inserting a new product's attributes, I get this error:

1054 - Unknown column 'products_options_track_stock' in 'field list'

 

insert into products_options (products_options_id, language_id, products_options_name, products_options_sort_order, products_options_track_stock) values ('25', '1', 'White', '1', '0')

 

[TEP STOP]

 

1054 - Unknown column 'products_options.products_options_track_stock' in 'where clause'

 

select products_name, products_options_name as _option, products_attributes.options_id as _option_id, products_options_values_name as _value, products_attributes.options_values_id as _value_id from products_description, products_attributes, products_options, products_options_values where products_attributes.products_id = products_description.products_id and products_attributes.products_id = '63' and products_attributes.options_id = products_options.products_options_id and products_attributes.options_values_id = products_options_values.products_options_values_id and products_description.language_id = 1 and products_options_values.language_id = 1 and products_options.products_options_track_stock = 1 and products_options.language_id = 1 order by products_attributes.options_id, products_attributes.options_values_id

 

[TEP STOP]

Its trying to access a column that is not there. No where in the installation instructions does it tell me to do anything to my database. From my searches of the forums, I'm thinking this has something to do with the QT Pro, which I have never installed. Do I need to add this column to the db? If so, I don't know how to write that code, and I'm wondering why this package didn't come with it. Or, do I have to have this QT pro installed?

 

There are no references to the column in any of the files I edited, only in the attribute manager files.

 

Can anyone help? I'd like to be able to use this add on! Thanks!

Share this post


Link to post
Share on other sites

Jenica,

 

you don't need to install QT Pro. In the latest version this plugin is tutned on by default. So, simple disable it by do following:

 

find catalog\admin\attributeManager\classes\attributeManagerConfig.class.php and edit line 65 "AM_USE_QT_PRO", set it to "false".

Share this post


Link to post
Share on other sites

Hmmm... Very strange. This part works for years and nobody report for problems. Are you shure you install contrib properly and there are no other scripts/contributions that may conflict with AJAX AM?

 

 

There is not much to do wrong, i will check it one moore time.

I use Qtpro, I have one thumbnail contb this one 'On the Fly' Auto Thumbnailer using GD Library

Can it be that one?? dont know, i m not so good in php ans scripts.

Share this post


Link to post
Share on other sites

Now i have made the installation 1 moore time and it still the same, i have compare the to configure.php files and tehy ar the same.

When i expens the + it shows attriutes in 0.5 sek then jumps to this site http://xxxxxxx.xx/xxxxxx/admin/categories.php?cPath=3_22&pID=519&action=new_product_preview

 

I dont know but the problem can be here "action=new_product_preview" but what is it that makes it go there??

 

I have <!-- tinyMCE --> installed to can it be that???

 

 

 

 

 

There is not much to do wrong, i will check it one moore time.

I use Qtpro, I have one thumbnail contb this one 'On the Fly' Auto Thumbnailer using GD Library

Can it be that one?? dont know, i m not so good in php ans scripts.

Share this post


Link to post
Share on other sites

I have 'On the Fly' Auto Thumbnailer too. No problem with it. tinyMCE... very low possibility. But it need to be tested. I have HTML Area.

"action=new_product_preview"

Where do you find this code in AJAX AM contrib? And what a hell it is doing there? Post fragment of this code, please.

Edited by RusNN

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

×