Jump to content
Sign in to follow this  
aspiringdeveloper

Grid Attributes under development

Recommended Posts

Due to some confustion about this contribution, I have created a new thread (see the old one for background information (http://forums.oscommerce.com/index.php?showtopic=299748)

 

Here is a screenshot

 

productattributeswithgrid.jpg

 

 

  1. Here is some documentation- installation and Usage. Modifications to existing OsC RC2 files is required. Please read pdf carefully
  2. Here is live proof it works
  3. Here is the download to the grid.php file (you will need to modify files as stipulated in step 1 and then extract grid.php to the indicated folders
  4. Download V1.1 from contributions for already edited files.

 

One note: Recommended PHP 5 until someone can confirm otherwise.

 

 

I need some feedback to make this better :lol:

Obviously the look of the grid itself needs work but at least the mechanics are all working.

Edited by aspiringdeveloper

Share this post


Link to post
Share on other sites

There have been many alleged bugs bugs reported in the previous thread but none that I can reproduce.

 

The Grid works for me with the following setup:

 

osCommerce Online Merchant v2.2 RC2a

PHP Version: 5.2.4 (Zend: 2.2.0)

Database: MySQL 5.0.27-standard

Server OS: Linux 2.4.31

HTTP Server: Apache

 

 

If you are experiencing bugs, please specify in as much details the error and your setup.

 

Thank you

Share this post


Link to post
Share on other sites

Hi,

This contribution works ok.

 

When I installed it the errors that were given on the add product page where

 

Warning: Invalid argument supplied for foreach() in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 552

 

Warning: Invalid argument supplied for foreach() in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 558

 

Warning: Invalid argument supplied for foreach() in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 591

 

Warning: reset() [function.reset]: Passed variable is not an array or object in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 597

 

Warning: Invalid argument supplied for foreach() in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 599

 

Warning: Invalid argument supplied for foreach() in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 608

 

Warning: reset() [function.reset]: Passed variable is not an array or object in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 614

 

Warning: Invalid argument supplied for foreach() in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 616

 

Errors :3 :Need to set unique row and col

Share this post


Link to post
Share on other sites
Hi,

This contribution works ok.

 

When I installed it the errors that were given on the add product page where

 

Warning: Invalid argument supplied for foreach() in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 552

 

Warning: Invalid argument supplied for foreach() in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 558

 

Warning: Invalid argument supplied for foreach() in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 591

 

Warning: reset() [function.reset]: Passed variable is not an array or object in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 597

 

Warning: Invalid argument supplied for foreach() in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 599

 

Warning: Invalid argument supplied for foreach() in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 608

 

Warning: reset() [function.reset]: Passed variable is not an array or object in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 614

 

Warning: Invalid argument supplied for foreach() in H:\sokkit\site\cartgrid\admin\includes\classes\grid.php on line 616

 

Errors :3 :Need to set unique row and col

 

 

Yes this bug was reported before. I thought I had fixed it in the version 1.3 that is uploaded on my server however I may have missed a couple of lines please get Version 1.4 here.

 

You will not find it in the contributions section of the forum until I know for sure from you guys whether this is fixing the problem. Remmeber, PHP5 is not giving me an error so I rely on you guys to let me know and help me to better help you.

 

 

Explanation: The errors being produced seem to be caused by the foreach() not finding an iterable array.

 

To fix it I have basically added a trap for first checking that an array exists in $_POST['edit']['price'] with the if (is_array($pricedit)){

statement.

 

Try that fix if you haven't already. If it still gives the foreach() errror, then back to the drawing board.

 

 

$pricedit=$_POST['edit']['price'];
if (is_array($pricedit)){
foreach( $pricedit as $gid=>$price){
if (!is_numeric($price)){$price_error="ENTER NUMERIC PRICE"; $err=true; $error['price'][]=$gid;}
else{$query="UPDATE products_grid SET grid_values_price ='".$price."' WHERE products_grid_id = ". (int)$gid." LIMIT 1";
mysql_query($query);
}}}

 

 

A few other places I added the test ''if (is_array(..))''

Edited by aspiringdeveloper

Share this post


Link to post
Share on other sites
Yes this bug was reported before. I thought I had fixed it in the version 1.3 that is uploaded on my server however I may have missed a couple of lines please get Version 1.4 here.

 

 

 

 

$pricedit=$_POST['edit']['price'];
if (is_array($pricedit)){
foreach( $pricedit as $gid=>$price){
if (!is_numeric($price)){$price_error="ENTER NUMERIC PRICE"; $err=true; $error['price'][]=$gid;}
else{$query="UPDATE products_grid SET grid_values_price ='".$price."' WHERE products_grid_id = ". (int)$gid." LIMIT 1";
mysql_query($query);
}}}

 

 

A few other places I added the test ''if (is_array(..))''

 

 

Shall I assume its working 100% now? Did the V1.4 grid.php fix help?

Edited by aspiringdeveloper

Share this post


Link to post
Share on other sites
Yes it did.

Just checking other bits out

 

 

Small issue with same name values, say you have "small" for two diff type attributes error msg =

 

1062 - Duplicate entry '14-1' for key 1

 

insert into products_options_values (products_options_values_id, language_id, products_options_values_name) values ('14', '1', 'small')

Share this post


Link to post
Share on other sites
Small issue with same name values, say you have "small" for two diff type attributes error msg =

 

1062 - Duplicate entry '14-1' for key 1

 

insert into products_options_values (products_options_values_id, language_id, products_options_values_name) values ('14', '1', 'small')

 

Also, if I edit the grid price the page will reset the combo box for tax to "taxable goods" when orginally it was saved as "none"

 

Cannot change price either :-s

 

Can you send me your as a zip file?

Share this post


Link to post
Share on other sites
Also, if I edit the grid price the page will reset the combo box for tax to "taxable goods" when orginally it was saved as "none"

 

Cannot change price either :-s

 

Can you send me your as a zip file?

 

taxable good switching error: Does this happen only when you edit the grid data?

 

I am using the same grid.php as you are. The error could be in the integration with the categories.php file.

I am not getting the duplicate key error that you received. It must be another php4 thingy.

 

 

Can you be more specific? Were you in the products_attributes module or the categories module?

 

Entering the same description for 2 attributes is not a key violation. The tables do no use the description as primary keys. This error must be being caused by something else. Is there another attribute with the ID 14? Normally the system increments the attribute id # for each new attribute so that key violations don't occur. I'll keep an eye on that bug. In my first versions of the edits to the product_attributes.php, the attribute # got reset to 1 whenever the user switched to an empty option. I since fixed that.

 

Maybe there is an error somewhere in your edits to the product_attributes.php file? Possibly I made a typo in the readme. Try to use the pre-edited product_attributes.php that I uploaded. If that fixes the problem, then it means there is an error in the manual edit made to product_attributes.php.

Edited by aspiringdeveloper

Share this post


Link to post
Share on other sites

Regarding the duplicate key error, I have been able to reproduce it only by brute force. The way in which I re-produced the error is not really a bug but merely the nature of session variables.

 

Let me explain:

 

When I am in product attributes and I create lets say the attribute 'small' for the option 'size'- the system assigns ID #14 for the the next available value option id key. If I then clear my internet cookies or otherwise force my session variables to expire, then try to go back to the exact same screen in product attribute then the script doesn't remember the last variable of 14 for the key. The system still thinks that the a value attribute last assigned was 13 and attempts to make a new 14 only to create a key error.

 

So far I haven't encountered the error through casual use but I'll keep my eye on it. Once again, I cannot test for php4 issues.

 

PS. Feel free to work on my source code to improve the contribution.

Edited by aspiringdeveloper

Share this post


Link to post
Share on other sites
Regarding the duplicate key error, I have been able to reproduce it only by brute force. The way in which I re-produced the error is not really a bug but merely the nature of session variables.

 

Let me explain:

 

When I am in product attributes and I create lets say the attribute 'small' for the option 'size'- the system assigns ID #14 for the the next available value option id key. If I then clear my internet cookies or otherwise force my session variables to expire, then try to go back to the exact same screen in product attribute then the script doesn't remember the last variable of 14 for the key. The system still thinks that the a value attribute last assigned was 13 and attempts to make a new 14 only to create a key error.

 

So far I haven't encountered the error through casual use but I'll keep my eye on it. Once again, I cannot test for php4 issues.

 

PS. Feel free to work on my source code to improve the contribution.

 

I guess noone is having issues with this contribution or else no one is using it for whatever reason. If there is any hesitation that someone has in trying it, please voice your concern in this thread.

 

Thanks

Share this post


Link to post
Share on other sites
I guess noone is having issues with this contribution or else no one is using it for whatever reason. If there is any hesitation that someone has in trying it, please voice your concern in this thread.

 

Thanks

 

Is it possibile to have a simpler install guide (for code modifications), because the pdf file is very confusing now.

 

A classical txt guide with:

 

SEARCH

REPLACE WITH

INSERT BEFORE

INSERT AFTER

 

will be much more better. Thank you!

 

You contribution is very usefull for those having a big amount of sizes for every article.

 

One question: is it possible to copy and duplicate the grid and apply it to more articles, without having to re-do the grid completely?


I love oscommerce and OS software! I'm not a programmer, I'm only a learning boy and a translator :) I love full contribution packages!

Share this post


Link to post
Share on other sites
Is it possibile to have a simpler install guide (for code modifications), because the pdf file is very confusing now.

 

A classical txt guide with:

 

SEARCH

REPLACE WITH

INSERT BEFORE

INSERT AFTER

 

will be much more better. Thank you!

 

 

Sorry, I tried to make the guide clear. I guess I should have informed myself of the os commerce etiquete for the readme install guides. It could be that its not clear because everyone is accustomed to the format you mention (FINDxxx REPLACE WITH yyy ).

 

However, the pdf guide is actually easier to follow IMHO if you give it a chance. The way to use the guide is as follows:

 

Each file requiring modification is given a snapshot for the file in the relative section of the php file. You can easilly find where to look in the file by looking at the matching text. This mimics the 'FIND' step.

 

The shaded text in the pdf are the inserts required. Where you see strike out text are the text to remove.

 

 

In summary: Insert shaded text / Remove strike through text

 

 

 

One question: is it possible to copy and duplicate the grid and apply it to more articles, without having to re-do the grid completely?

 

 

Not now but that would be extremely useful - even for me. I think I'll design a grid template function and then the user can choose either to create a blank grid or copy from template. Excellent idea.

Edited by aspiringdeveloper

Share this post


Link to post
Share on other sites
Sorry, I tried to make the guide clear. I guess I should have informed myself of the os commerce etiquete for the readme install guides. It could be that its not clear because everyone is accustomed to the format you mention (FINDxxx REPLACE WITH yyy ).

 

However, the pdf guide is actually easier to follow IMHO if you give it a chance. The way to use the guide is as follows:

 

Each file requiring modification is given a snapshot for the file in the relative section of the php file. You can easilly find where to look in the file by looking at the matching text. This mimics the 'FIND' step.

 

The shaded text in the pdf are the inserts required. Where you see strike out text are the text to remove.

 

 

In summary: Insert shaded text / Remove strike through text

 

 

 

 

 

 

Not now but that would be extremely useful - even for me. I think I'll design a grid template function and then the user can choose either to create a blank grid or copy from template. Excellent idea.

 

Thank you for your answer :)

 

The idea came to me because I use ajax attribute manager and the template function is very usefull!

 

Another question: is it possible to use grid attributes only for certain products and use normal attributes in oder products? Because in my last project, we selle mattresses (where grid attributes are really usefull) and other products.


I love oscommerce and OS software! I'm not a programmer, I'm only a learning boy and a translator :) I love full contribution packages!

Share this post


Link to post
Share on other sites
Thank you for your answer :)

 

The idea came to me because I use ajax attribute manager and the template function is very usefull!

 

Another question: is it possible to use grid attributes only for certain products and use normal attributes in oder products? Because in my last project, we selle mattresses (where grid attributes are really usefull) and other products.

 

 

Mix and match all you want. I do it all the time. Some products have a grid plus attributes, some just attributes, some just a grid.

Share this post


Link to post
Share on other sites

How does it works if I want to make a special sale (20% off) for a product with grid attributes? Is it the special reduction working for every attribute in the grid?


I love oscommerce and OS software! I'm not a programmer, I'm only a learning boy and a translator :) I love full contribution packages!

Share this post


Link to post
Share on other sites
How does it works if I want to make a special sale (20% off) for a product with grid attributes? Is it the special reduction working for every attribute in the grid?

 

 

That's next on my things to do list. I want to see the popularity of the contribution as it is now go up first as it is. If I invest to much in new features, I may create more bugs and piss off a lot of users. I was hoping for some people to jump in and help out.

 

If someone could check that my file modification documentation works out (FIND xxx REPLACE yyyy) and if not improve upon the documentation, that would help me.

Share this post


Link to post
Share on other sites
How does it works if I want to make a special sale (20% off) for a product with grid attributes? Is it the special reduction working for every attribute in the grid?

 

Good news: I've now modded the admin/specials.php and catalog/specials.php to be able to work in conjunction with grid attributes.

;)

 

The bad news is that I am hesitating uploading the upgraded contribution though because I feel that there is a lack of positive feedback about this grid attributes contribution.

 

Either people don't trust it to try it or that the install instructions are sloppy and they fear alot of bugs or interference with there existing mods will hamper them. It's a shame because I know that a lot of you would find it useful. For instance one of the many benefits is that in using grid attributes instead of regular attributes you automatically manage inventory for a member of a product grid. This is unlike simple one-dimensional drop down attributes.

 

With that said I'd like to make a deal with the community here:

 

Would someone please try the grid attributes as it is and provide a positive testimonial that they got it to work, or else help improve it and upload a version 1.4 with changes that they made if they found it to be buggy on there system. I am tired of being the only one saying its working.

 

If the issue is that the install instructions seem daunting and confusing, then can someone update the install instructions in a simple manner so that others will not be daunted. I've spent enough time already on the mod and need a break.

 

I am confident once a few people try this that there will be a major snowball effect. I need some brave soldiers to get the momentum going.

 

When I see some interest from the community I will upload the specials.php modded files.

Edited by aspiringdeveloper

Share this post


Link to post
Share on other sites

If Installed in fresh install an getting error message

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /hermes/bosweb/web281/b2813/ipw.mssigns/public_html/iv/includes/classes/grid.php on line 801

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /hermes/bosweb/web281/b2813/ipw.mssigns/public_html/iv/includes/functions/database.php on line 99

 

I uploaded compleate files no copy & paste

Share this post


Link to post
Share on other sites
If Installed in fresh install an getting error message

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /hermes/bosweb/web281/b2813/ipw.mssigns/public_html/iv/includes/classes/grid.php on line 801

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /hermes/bosweb/web281/b2813/ipw.mssigns/public_html/iv/includes/functions/database.php on line 99

 

I uploaded compleate files no copy & paste

 

Did you use version 1.4- see post 4 above.

 

Use my modded files for a clean fresh install but then overwrite the 2 grid.php files in version 1.4.

Edited by aspiringdeveloper

Share this post


Link to post
Share on other sites
Did you use version 1.4- see post 4 above.

 

Use my modded files for a clean fresh install but then overwrite the 2 grid.php files in version 1.4.

 

Hi aspiringdeveloper,

 

I need to know if this contribution is compatible with PWA,

 

Thank you for your time and effort!! ;)

Share this post


Link to post
Share on other sites
Due to some confustion about this contribution, I have created a new thread (see the old one for background information (http://forums.oscommerce.com/index.php?showtopic=299748)

 

Here is a screenshot

 

productattributeswithgrid.jpg

 

 

  1. Here is some documentation- installation and Usage. Modifications to existing OsC RC2 files is required. Please read pdf carefully
  2. Here is live proof it works
  3. Here is the download to the grid.php file (you will need to modify files as stipulated in step 1 and then extract grid.php to the indicated folders
  4. Download V1.1 from contributions for already edited files.

 

One note: Recommended PHP 5 until someone can confirm otherwise.

 

 

I need some feedback to make this better :lol:

Obviously the look of the grid itself needs work but at least the mechanics are all working.

 

Hi aspiringdeveloper,

 

Two times I already try to install the GRID ATTRIBUTES with no exit.

:blink:

It is a fantastic idea and I have no doubt that it works, but the instructions referent at the files:

 

Catalog\incudes\classes\shopping_cart.php

Catalog\admin\categories.php

Catalog\admin\products_attributes.php

 

… seem that are incomplete. (Is not only the question of search and replace.)

 

Please explain more in detail so we can benefit of your thread.

 

If you have some suggestions, please let me know. If don’t, thank you again. I really appreciate your efforts.

;)

Share this post


Link to post
Share on other sites

Hi aspiringdeveloper,

 

I've just installed this contrib. It's very useful for my shop, but unfortunately it's not work :'( When I click on Create Grid button the four messages "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in F:\home\L.ru\www\admin\includes\functions\database.php on line 122" appears and 2 empty combos for row and col appears. What should I do to fix this? I really need this contrib work.

Share this post


Link to post
Share on other sites

Hey, I'm installing your addon now and from what I've seen it is good. Since you wanted some feedback I will describe my problems as I go. Please don't take this as negative criticism, I'm only trying to make your good addon even better :)

 

Does not work after installation - in admin, the select boxes are empty and the error log lists 4 PHP Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ..catalog\\admin\\includes\\functions\\database.php on line 99, referer: http://localhost:8088/catalog/admin/catego...ion=new_product

 

documentation: instructions for new function tep_get_uprid($prid, $params ,$gid=0) are missing an } at the end, and they get split on two pages , so my foxit pdf reader inserts also the page title in the code which has to be removed. also some line breaks are incorrect with this pdf reader. consider having documentation as a HTML page. Also doc claims it's for version 1.2, though filename is gridversion1.4.zip

 

function tep_check_stock( should be in documentation before tep_get_uprid as it is in the file.

 

your tabulation and placement of { are inconsistent for new functions in general.php and some other places. Also you sometimes insctruct to remove { and then don't include it in your replacement code ("if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {" for instance and there was at least one more) .

 

functions calculate() and get_products() - you should mention that one must first find these parts - it is not as you have written

 

"Add new Method:" I know what this means, but you should be more descriptive.

 

in admin/categories.php also the lines "<script language="JavaScript" type="text/javascript">" and "</script>" have to be added

 

line $inputs = ''; is not after what you marked to delete, but much further. also a few lines before, when you delete "<select name="option_id">" you do not delete the closing </select>

 

Serious error:

you mention to change (in includes/classes/shopping_cart.php)

if (($check_product !== false) && ($check_product['products_status'] == '1')) {

if ($notify == true) {

with

if (($check_product !== false) && ($check_product['products_status'] == '1')&&(

(int)$grid_id=='0' || $check_grid['grid_status']=='1')) {

 

this will cause an error because one { will be missing. I did not delete if ($notify == true) { (but i moved it one line down) and it seems to be ok but I dunno what this will do.

 

i also think it would actually be quicker/more clear to patch if you followed the somewhat standard find/replace/insert/delete syntax, maybe with line numbers.

 

Thank you for the addon!

Share this post


Link to post
Share on other sites

ok, from some debugging, it seems that the correct language is not being used - in Grid constructor language is hard coded as 1 and it does not seem to be changed, which is not correct for my store.

 

also you should ommit the AUTO_INCREMENT setting in table creation

 

ok, i spent 5 hours with this addon and now that it is working it is not working as it should. It is badly written and lacks good documentation. I will now spend another hour to remove it :(

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  

×