Jump to content
Sign in to follow this  
djmonkey1

Product Listing in Columns v2.0

Recommended Posts

Some people have emailed me about problems with this contribution, so I decided to open a support thread for it.

 

First off, there's a bug in the current release (v2.0).

 

Under certain conditions product attributes will not be passed to the cart correctly.

 

To fix this perform the following steps:

 

In application_top.php change

 

 

// customer adds multiple products from the products_listing page
case 'add_multiple' :
while ( list( $key, $val ) = each( $HTTP_POST_VARS ) )
{
if (substr($key,0,11) == "Qty_ProdId_" || substr($key,0,11) == "Qty_NPrdId_")
{
$prodId = substr($key, 11);
$qty = $val;
if ($qty <= 0 ) continue;
// Choose here whether or not you want ot replace the quantity, or add to. IMPORTANT CHOOSE ONLY ONE METHOD!!!
// uncomment the following line to allow incrementing the quantity
$cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId, $HTTP_POST_VARS['id']))+($qty), $HTTP_POST_VARS['id']);
// uncomment the following line to disallow incrementing the quantity
//$cart->add_cart($prodId, $qty, $HTTP_POST_VARS['id']);
}
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;

 

to this:

 

// customer adds multiple products from the products_listing page
case 'add_multiple' :
while ( list( $key, $val ) = each( $HTTP_POST_VARS ) )
{
if (substr($key,0,11) == "Qty_ProdId_" || substr($key,0,11) == "Qty_NPrdId_")
{
$prodId = substr($key, 11);
$qty = $val;
if ($qty <= 0 ) continue;
if(isset($HTTP_POST_VARS["id_$prodId"]) && is_array($HTTP_POST_VARS["id_$prodId"])) {
// We have attributes
$cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId,$HTTP_POST_VARS["id_$prodId"]))+$qty, $HTTP_POST_VARS["id_$prodId"]);
} else {
// No attributes
$cart->add_cart($prodId, $cart->get_quantity($prodId)+$qty);
}
}
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;

 

Note in this second step shown below it's just a matter of commenting out line 153 and uncommenting out line 152 in product_listing_col.php. Make sure the change you make is under case 'PRODUCT_LIST_MULTIPLE': (lines 128-157).

 

In product_listing_col.php change

 

//$lc_text .= tep_draw_pull_down_menu('id_'.$listing['products_id'].'[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]);
$lc_text .= tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]);

to this:

 

$lc_text .= tep_draw_pull_down_menu('id_'.$listing['products_id'].'[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]);
//$lc_text .= tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]);


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites
Does this contribution allow the customer to sort by Price (Low to High, High to Low), Name, Brand, etc?

 

Wow- that's just crazy talk. Is there any contribution that does this?


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

Ha- I'd never noticed that.

 

Learn something new every day.

 

I imagine it may be difficult to implement such functionality into this contribution. For me, anyway.


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

i haven't looked at it , it shouldn't be that difficult the file is pretty small, but not very practical since you will have multiple columns look at the original code it should put you in the right direction.

Share this post


Link to post
Share on other sites
Never mind about the difficulty thing- just have to add in the appropriate link(s).

 

Maybe a drop down menu? Getting the code to dynamically generate a drop down menu should be fun. It should work with and without SPPC too, so I can update both contributions.....

 

Muah ha ha ha ha ha.....


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

if you are working on this there is a contribution that lets you switch from list to column in the admin section and if you want to be really crazy allowing to have diffrent type of listing for diffrent category

you can add the choice to each category it shouldn't be that difficult

just one if statment and allowing for entering the choice in the category

Share this post


Link to post
Share on other sites
if you are working on this there is a contribution that lets you switch from list to column in the admin section and if you want to be really crazy allowing to have diffrent type of listing for diffrent category

you can add the choice to each category it shouldn't be that difficult

just one if statment and allowing for entering the choice in the category

 

You are a madman. What's the name of the contribution you mentioned?


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

i just got cut off by a pm two extra things that you should keep in mind is how the changes regarding the sort order has to be carried from one category to the other

and second if you can have diffrent column numbers for each category

but maybe i am over doing it lol

Share this post


Link to post
Share on other sites

That would be awesome to adjust the product listing layout for different categories from the admin panel. Are you planning to do this?

Share this post


Link to post
Share on other sites

I just installed this mod and its working great so far, I'm just wondering about a couple things:

 

1.) I noticed that the row color changes on the 2nd row of products and carries over into the 3rd row as well. How can I set the rows to all stay the same color?

 

3.) I think it would look good to add a lin break above the first row to give it a little more padding.

 

Here is a image to illustrate:

 

screen4ud.jpg

 

Thanks for your help and for providing this great mod!!

Edited by jeffy777

Share this post


Link to post
Share on other sites
I just installed this mod and its working great so far, I'm just wondering about a couple things:

 

1.) I noticed that the row color changes on the 2nd row of products and carries over into the 3rd row as well. How can I set the rows to all stay the same color?

 

3.) I think it would look good to add a lin break above the first row to give it a little more padding.

 

Here is a image to illustrate:

 

 

Thanks for your help and for providing this great mod!!

 

 

For the spacing along the top, adjust or add the "border-spacing:" property under "TABLE.productListing" in your stylesheet. Mine says "border-spacing: 2px;".

 

I can't see the color change you're talking about.

 

 

 

That would be awesome to adjust the product listing layout for different categories from the admin panel. Are you planning to do this?

 

 

You could do it manually from within the product_listing_col file but it would get really hairy if you have more than a few categories.

 

It's definitely a nice idea.


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites
For the spacing along the top, adjust or add the "border-spacing:" property under "TABLE.productListing" in your stylesheet. Mine says "border-spacing: 2px;".

 

I was thinking of using a line break, inserting a <BR>. I could probably figure it out, but I thought maybe it would be easier for you to tell me where to put it :)

 

I can't see the color change you're talking about.

 

Maybe the contrast isn't right on your monitor, an LCD perhaps? There is a shift in color from white to light gray where the arrow is pointing and the gray covers both the 2nd and 3rd rows. Its a very subtle change in color but it is there.

 

You could do it manually from within the product_listing_col file but it would get really hairy if you have more than a few categories.

 

It's definitely a nice idea.

 

I thought about that and I'm actually doing somthing similiar on another store with a custom display contrib that i put together, but if the admin of the store doesn't know php then they can't adjust the category display. It would be much more efficient from the admin panel.

Edited by jeffy777

Share this post


Link to post
Share on other sites
I was thinking of using a line break, inserting a <BR>. I could probably figure it out, but I thought maybe it would be easier for you to tell me where to put it :)

Maybe the contrast isn't right on your monitor, an LCD perhaps? There is a shift in color from white to light gray where the arrow is pointing and the gray covers both the 2nd and 3rd rows. Its a very subtle change in color but it is there.

I thought about that and I'm actually doing somthing similiar on another store with a custom display contrib that i put together, but if the admin of the store doesn't know php then they can't adjust the category display. It would be much more efficient from the admin panel.

 

 

You're right about the color- I couldn't see it on my laptop. I'll have to check it's color settings.

 

This has to do with the stylesheet, but it's first and foremost a problem with the code. It's producing the table in a strange way- the first tr should say

 

<tr class="productListing-odd">

 

but all it reads is

 

<tr>

 

Also a superfluous

<tr class="productListing-odd">
<td class="productListing-odd"></td>
 </tr>

is generated underneath the product listings.

 

I believe this is the section of code in question:

 

// WARNING the code assumes there are three products per row. To use a different number change the number
// at line 195: if ($column >= 3) and the code to fill up the table row below that accordingly
// $counter = $row;
// $class_for_buy_now = 'class="productListing-odd"';
// $list_box_contents[$row] = array('params' => 'class="productListing-odd"');

 $rows++;

if (($rows/2) == floor($rows/2) && ($row > $counter)) {
  $list_box_contents[$row] = array('params' => 'class="productListing-even"');
  $class_for_buy_now = 'class="productListing-even"';
  $counter = $row;
} else {
 if ($row > $counter) {
  $list_box_contents[$row] = array('params' => 'class="productListing-odd"');
  $class_for_buy_now = 'class="productListing-odd"';
  $counter = $row;
 }
}

 

As a temporary fix you can delete or comment out that entire section of code, however this removes the ability to edit the look and feel of the layout using CSS. I've fiddled with it a bit but the results haven't been satisfactory.

 

Incidentally, where it mentions line 195 in the code above it should say line 238.

 

Even with that fix a superfluous

 <tr>
<td></td>
 </tr>

is still generated.

 

For the <br>, I honestly don't know what else to tell you. The table is dynamically generated and the issue you're experiencing has to do with border spacing. As far as I know there is no good way to just throw a <br> in there, because it would put a <br> on top of every row. Adding a couple pixels to the border spacing attribute in the stylesheets seems to me to be the best way to handle this. My pics do not show up that close to the border on any of my sites.


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites
I believe this is the section of code in question:

 

// WARNING the code assumes there are three products per row. To use a different number change the number
// at line 195: if ($column >= 3) and the code to fill up the table row below that accordingly
// $counter = $row;
// $class_for_buy_now = 'class="productListing-odd"';
// $list_box_contents[$row] = array('params' => 'class="productListing-odd"');

 $rows++;

if (($rows/2) == floor($rows/2) && ($row > $counter)) {
  $list_box_contents[$row] = array('params' => 'class="productListing-even"');
  $class_for_buy_now = 'class="productListing-even"';
  $counter = $row;
} else {
 if ($row > $counter) {
  $list_box_contents[$row] = array('params' => 'class="productListing-odd"');
  $class_for_buy_now = 'class="productListing-odd"';
  $counter = $row;
 }
}

 

Thanks for looking into all of this. I was just looking at that code myself trying to see if I could figure something out, but I was unsuccessful...

 

For the <br>, I honestly don't know what else to tell you. The table is dynamically generated and the issue you're experiencing has to do with border spacing. As far as I know there is no good way to just throw a <br> in there, because it would put a <br> on top of every row. Adding a couple pixels to the border spacing attribute in the stylesheets seems to me to be the best way to handle this. My pics do not show up that close to the border on any of my sites.

 

I'll try adding some spacing. The store I'm working on is basically a default install, so I don't know why my pics show up closer than yours :blink:

 

BTW what is the best way to change the layout to show only 2 coulmns? I changed the ($column >= 3) to ($column >= 2), but do i need to edit to the part that fills in the empty cells as well?

 

Keep up the good work and please let me know if you figure anything else out with the row colors :)

Edited by jeffy777

Share this post


Link to post
Share on other sites

I have 2 questions.....

 

Number 1,

 

After each row, I would like to have a horizontal line.... just a simple <hr> or something like that...... how can I do it?

 

I was playing around with the product_listing_col.php file.... and I was able to get a line to display under each individual item, but it did not continue for the whole width of the table..... i am sure that it cannot be too difficult... i am just not seeing what it is.

 

 

 

 

Number 2, is there something hardcoded into the product_listing file that will let me control the sorting process (outside of the control panel) the reason i say this is if you look at http://carpenoctem.tv/catalog/index.php?cPath=50_51 you will notice that not all of the names are in alphabetical order.... even though i have the setting in the control panel marked.

 

Thanks

 

Mark

Share this post


Link to post
Share on other sites

great mod DJ thanks :) - just what I'm looking for ...

 

 

what I'd like to do is to display my products in columns with pics without the "buy now" button ... can i do it with this?

 

thanks again

 

sammi

Share this post


Link to post
Share on other sites
Number 2, is there something hardcoded into the product_listing file that will let me control the sorting process (outside of the control panel) the reason i say this is if you look at http://carpenoctem.tv/catalog/index.php?cPath=50_51 you will notice that not all of the names are in alphabetical order.... even though i have the setting in the control panel marked.

 

That's strange that they aren't sorting properly...

 

This is the contrib I use to sort products and it works great:

http://www.oscommerce.com/community/contributions,2541

 

what I'd like to do is to display my products in columns with pics without the "buy now" button ... can i do it with this?

 

I think you can turn that off in the admin panel under "Minimum Values", but I can't verify that right now.

Share this post


Link to post
Share on other sites
BTW what is the best way to change the layout to show only 2 coulmns? I changed the ($column >= 3) to ($column >= 2), but do i need to edit to the part that fills in the empty cells as well?

 

You should just be able to change the 3 to a 2. Let me know if that doesn't work.

 

 

 

great mod DJ thanks :) - just what I'm looking for ...

what I'd like to do is to display my products in columns with pics without the "buy now" button ... can i do it with this?

 

thanks again

 

sammi

 

That's the add multiples option (no buy now button, has a text box for quantity for each item and an "add to cart" button at the bottom of the page).

 

If you want columns without the buy now button or text boxes for quantity, just enter a 0 for each option in admin->configuration->product listing.

Edited by djmonkey1

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites
I have 2 questions.....

 

Number 1,

 

After each row, I would like to have a horizontal line.... just a simple <hr> or something like that...... how can I do it?

 

I was playing around with the product_listing_col.php file.... and I was able to get a line to display under each individual item, but it did not continue for the whole width of the table..... i am sure that it cannot be too difficult... i am just not seeing what it is.

Number 2, is there something hardcoded into the product_listing file that will let me control the sorting process (outside of the control panel) the reason i say this is if you look at http://carpenoctem.tv/catalog/index.php?cPath=50_51 you will notice that not all of the names are in alphabetical order.... even though i have the setting in the control panel marked.

 

Thanks

 

Mark

 

For the horizontal line, I don't know. You'd have to add in extra code for that, maybe a whole new table? You could add it in at the bottom of each listing, but it wouldn't go across the whole table (as you've seen). It might be simple, but it might be really complex. Maybe CSS? I know you could add a border around every table cell, but that's not what you're looking for. Theoretcially you should be able to set "border-bottom" but I've tried that before and it didn't work, however I may have done it wrong. CSS can be like PHP, one wrong move and you're road kill.

 

As for sorting, it's not supposed to sort. The default sort should be A-Z. Maybe your items are actually being sorted by price? That custom sort order contribution looks cool, I may try that out in my store. Maybe even roll it into this contribution.

 

Adding the ability to have the customer sort the products is on the "To Do" list. Unfortunately I have a real job....

 

Gotta go, U2 beckons....


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

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  

×