Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help with warning: Division by zero error in product_listing_col.php


Recommended Posts

Hi I'm new to Oscommerce. Hope to seek some assistance on installing Product Listing Column contribution. Seems like everyone else could get it working fine, I must be missing something... please help me on this. Searched the forum but could not find answers to this.

 

Tried to install Product Listing Columns 2.2.7, fresh install of Oscommerce RC2 and fresh install of Product Listing Column, but could not get it to work. No column options in the admin, only the Display Buy Now Column available.

And I get the division by zero in product_listing_col.php errors, but it does show a box of the products in columns of 3 with buy now buttons, at the bottom after the warnings.

 

"Warning: Division by zero in \catalog\includes\modules\product_listing_col.php on line 140"

"Warning: Division by zero in \catalog\includes\modules\product_listing_col.php on line 329"

 

Would be most grateful if someone could guide me on the right track. Thank you.

Link to comment
Share on other sites

Would be most grateful if someone could guide me on the right track.

Looks like you didn't run the list_multi.sql in your phpMyAdmin (or whatever tool you have available to edit your database directly). That sql file is supposed to add the define PRODUCT_LIST_NUMCOL to your database.

If you don't need the attributes listing I think you can get away by adding close to the top includes/modules/product_listing_col.php:

define('PRODUCT_LIST_NUMCOL', '3');

Preferable before it is used say directly after line 22-23:

//version 2.2 modification
//if number of column per row is 1, include the original product_listing.php

Link to comment
Share on other sites

Looks like you didn't run the list_multi.sql in your phpMyAdmin (or whatever tool you have available to edit your database directly). That sql file is supposed to add the define PRODUCT_LIST_NUMCOL to your database.

If you don't need the attributes listing I think you can get away by adding close to the top includes/modules/product_listing_col.php:

define('PRODUCT_LIST_NUMCOL', '3');

Preferable before it is used say directly after line 22-23:

//version 2.2 modification
//if number of column per row is 1, include the original product_listing.php

 

Hurray! Thanks it worked! The columns came up! :D

I did imported and ran the sql file onto my database via my host server PHPMyAdmin control panel. It said the queries ran sucessfully. I ran it a few times too, and it gave me the zero division errors, before I posted my previous msg here. It says:

 

__________________________________________

Your SQL query has been executed successfully.

 

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Display Add Multiples column', 'PRODUCT_LIST_MULTIPLE', '0', 'Do you want to display the Multiple Quantity with Attributes column?', '8', '11', now());# Affected rows: 1

 

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Display Add Multiples with Buy Now column', 'PRODUCT_LIST_BUY_NOW_MULTIPLE', '0', 'Do you want to display the Multiple Quantity Buy Now with Attributes column?', '8', '12', now());# Affected rows: 1

 

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Number of column per row', 'PRODUCT_LIST_NUMCOL', '3', 'How many columns per row to dis[...]

___________________________________________

 

Did I get it right then? There seems to be only 3 lines ran instead of the 4 stated in the install instructions. I imported the file and also tried copying the queries and pasted them onto the run SQL screen. Both turns out same results. I'm not too familiar with SQL databases. I'm selling downloadable digital goods, would it be vital that the sql file should be run properly for the store to function well? Your advise is most appreciated.

 

Could you help me with the admin side too? I still only have the default options:

 

Display Product Image 1

Display Product Manufaturer Name 0

Display Product Model 0

Display Product Name 2

Display Product Price 3

Display Product Quantity 0

Display Product Weight 0

Display Buy Now column 1

Display Category/Manufacturer Filter (0=disable; 1=enable) 1

Location of Prev/Next Navigation Bar (1-top, 2-bottom, 3-both)

 

I did not get the additional Production Listing Column's options:

 

Display Add Multiples column OR Display Add Multiples with Buy Now column

 

Is there something I should do to get those options in my Admin-Cofig-Product Listing?

 

Really grateful for your help in the columns! :)

Link to comment
Share on other sites

Did I get it right then? There seems to be only 3 lines ran instead of the 4 stated in the install instructions.

Yes, there seem to be only three queries in there.

I imported the file and also tried copying the queries and pasted them onto the run SQL screen. Both turns out same results.

You will now have duplicate lines of that in your table configuration, which is not a good idea either. No clue why not a single one seems to show up in your store. Wrong database?

Link to comment
Share on other sites

Yes, there seem to be only three queries in there.

 

You will now have duplicate lines of that in your table configuration, which is not a good idea either. No clue why not a single one seems to show up in your store. Wrong database?

 

thank you for your help Jan Zonjee. While I hope that the contribution would've run beautifully like it did for the others, I'm happy now at least it displays in columns and without the zero division errors. Many thanks to you!

 

Could you help advise how I can remove the duplicate lines from the table configuration? If it is the wrong database, I'm guessing the product pics and product info pages would not show up? but it works ok for me.

Link to comment
Share on other sites

  • 1 month later...

Just as an aside - and I'm definitely not a PHP guru, you can change line 24 from: -

 

if (PRODUCT_LIST_NUMCOL == 1) {

 

to: -

 

if (PRODUCT_LIST_NUMCOL == 0) {

 

The product then works a treat. Be careful on how many products per row and the size of image you select!

 

Now if I can just centre the images...

Link to comment
Share on other sites

  • 1 month later...

eeeee! Thank you so much for this post! I'm so glad I wasn't the only one with this problem! Adding: define('PRODUCT_LIST_NUMCOL', '3'); worked like a charm for me as well! It's like watching your kid take his first step to hit refresh and watch the product descriptions arrange themselves into their neat little columns. Whew! After 7 hours of eye-numbing work, it was awful hitting that snag, but I'm so glad for this community!

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