Community Add-Ons
Previous - Next - With detailed info
for osCommerce Online Merchant v2.2
Previous Next Contribution v0.1
Build by Nirvana and Yoja
This contribution makes an previous and next button in the product_info.php page indepent from where you came.
As requested in: http://forums.oscommerce.com/viewtopic.php?t=38214
Minor code clean up
Moved the position of the previous/next buttons to below the product name and price
Added the ability to display the previous/next buttons under the products date added.
Both of the above are contoled in admin section. Go to Admin-->Configuration-->Product Listing. Select Location of Prev/Next Bar Location. (1-top, 2-bottom, 3-both)
Removed the back to category link. This link is now in the category name if it is displayed. The manufacturer name is not linked
Removed the links to the first/last product. Instructions on how to add them is in the install
Removed the if/else statements from inside the table cell tags and put them outside of the tags. A bit cleaner and easier to follow.
Added stock RC2A version product_info.php and the 2 language product_info.php files
This install/documentation
This is a full package
Update 09-01-2009 (v3.4.0):
CHANGED: added the link of the file 'Alt.Link Category Name'.
added buttons for 'first product of the category' and 'last product of the category'.
added a possibility, that the category name is not shown (simple way).
added other buttons without text.
Modifications: Simon Ankele osCommerceDE Name: SimonBremen
FIX: some html minor problems like html tag order
FIX: use <?php instead of <?
CHANGED: the way everything is computed $previous, $next, $counter, $position. This should be a bit cleaner and even a bit faster but not noticeable (1 loop instead of 2)
I did not experienced the problem mentionned previously so I cannot say if it fix it or not.
This Contribution Do not Work Properly.
Tested with PHP5/Mysql5
This Contribution Do not Work Properly. When You Search Product and You Click One, the followig error occurs :
Warning: reset() [function.reset]: Passed variable is not an array or object in.........../includes/products_next_previous.php on line 39
Warning: Variable passed to each() is not an array or object in........../includes/products_next_previous.php on line 41
THE FIX POSTED BY DIDILIO DO NOT WORK.
replace the line 39 to 41 with:
if (is_array($id_array))
reset ($id_array);
$counter = 0;
while (list($key, $value) = is_array($id_array)) {
This Create a infinite LOOP, and do not work properly.
SOMEONE ALREADY SUCCEED TO FIX THIS CONTRIBUTION ?
File is Full Package of 3.3 with buttons
There is an error when you search products, and click in one. I upload the php file.
Warning: reset() [function.reset]: Passed variable is not an array or object in /home/se000217/public_html/ropa-jeans/includes/products_next_previous.php on line 39
Warning: Variable passed to each() is not an array or object in /home/se000217/public_html/ropa-jeans/includes/products_next_previous.php on line 41
replace the line 39 to 41 with:
if (is_array($id_array))
reset ($id_array);
$counter = 0;
while (list($key, $value) = is_array($id_array)) {
There is an error when you search products, and click in one. I upload the php file.
Warning: reset() [function.reset]: Passed variable is not an array or object in /home/se000217/public_html/ropa-jeans/includes/products_next_previous.php on line 39
Warning: Variable passed to each() is not an array or object in /home/se000217/public_html/ropa-jeans/includes/products_next_previous.php on line 41
The previous category link was incompatible with my version of OSCommerce. (Most recent with patches). I have added an alternate method into the package.
In catalog/includes/products_next_previous.php
FIND
$prev_next_in = PREV_NEXT_CAT . ' ' . ($category_name_row['categories_name']);
CHANGE TO:
$prev_next_in = PREV_NEXT_CAT . ' <a style="text-decoration: underline" href="' . tep_href_link(FILENAME_DEFAULT, "cPath=$current_category_id") . '">' . ($category_name_row['categories_name']). '</u></b></font>';
THIS IS A COMPLETE PACKAGE
I'm a complete php dump but I managed to link back the category name in dABsever's update (prev-next v3). Very simple (of course). I just changed line 40-41 in catalog/includes/products_next_previous.php from:
$prev_next_in = PREV_NEXT_CAT . ' <u><b><font size="1" color="#ff0000">' . ($category_name_row['categories_name']) . '<u></b></font>';
$fPath = 'cPath=' . $cPath;
To:
$fPath = 'cPath=' . $cPath;
$prev_next_in = PREV_NEXT_CAT . ' <u><b><font size="1"><a style="text-decoration: underline" href="' . tep_href_link(FILENAME_DEFAULT, "$fPath&categories_id=$current_category_id") . '">' . ($category_name_row['categories_name']) . '</u></b></font>';
That is it! Works fine for me.
This is acomplete package.
Again, a great contribution for those who wish to have their products browse-able. However, I noted that our installation sorted products by Product Name, not ID.
Below is a quick change that allows the viewer to browse through your products as they are listed in the default listing mode.
How to solve this? It's easy (as far as I can see). In the products_next_previous.php file on line 29, find:
$products_ids = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc where p.products_status = '1' and p.products_id = ptc.products_id and ptc.categories_id = $current_category_id");
and replace this with:
$products_ids = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc where p.products_status = '1' and p.products_id = ptc.products_id and ptc.categories_id = $current_category_id and pd.products_id = p.products_id order by pd.products_name");
THIS IS NOT THE FULL CONTRIBUTION
This is a great little contribution, but the only problem is that it sorts the products via product_id. This isnt so great if you have a sort order contribution installed, and therefore want the product_id's to be called upon according to their sort order as defined in the products table.
How to solve this? It's easy (as far as I can see). In the products_next_previous.php file on line 29, find:
$products_ids = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc where p.products_status = '1' and p.products_id = ptc.products_id and ptc.categories_id = $current_category_id");
and replace this with:
$products_ids = tep_db_query("select p.products_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc where p.products_status = '1' and p.products_id = ptc.products_id and ptc.categories_id = $current_category_id order by p.products_sort_order");
That's it!
Previous & Next Product Buttons v3.2
This new version of Previous & Next Product Buttons (for product_info.php) contains new buttons styled as chevrons. Moreover, these buttons now show up at the right time and at the right place: i.e. both do not show if only one product is present in a given category, 'previous' button is not shown if e.g. "product 1 of 9" is selected, likewise, the 'next' button does not show when "product 9 of 9" is selected.
Screenshot included. Also included is a Photoshop file containing a chevron button for easy colour overlay to complement your own colour scheme.
Now easy install by "drop over" standard osC or file compare, see install.txt.
Skylla
Added compatibility for customers, which come on product info page from manufacturers infobox.
Firstly please excuse me for making this a version 2. But it seemed a version number was required and looking at the history V.2 seemed the best place to start a number.
This version fixes an issue I found where, when the Previous or Next button was clicked it reverseded product and category numbers in the URL.
This still worked but apart from it seeming to be wrong was stopping my latest contrib update, the Whos Online Enhacement contribution V1.8a from displaying the correct product name. (There is possibly other issues this may have caused also).
Big thanks to the original authors. Great little mod. Makes things so much easier for browsing.
This is a little bugfix for the 23 April 2004 version of Ray Knapp and probably the other versions too.
After installing the 23 april 2004 version I suddenly got occasional MYSQL errors like:
1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
It turned out this was caused by search engine links which linked to products I had removed from my database. A simple workaround for this is to replace
<?php
include (DIR_WS_INCLUDES . 'products_next_previous.php');
?>
with
<?php
if ($product_check['total'] >= 1) {
include (DIR_WS_INCLUDES . 'products_next_previous.php');
}
?>
in the product_info.php.
This probably only applies if you placed the include according to the installation instructions which is above the check for the existence of a product.
This is just an alternative way to use the previous page button i replace the code to use history back instead of back to the next page i made the mod because i found it better to go back to the viewed pages rather than to new ones
simply replace this code in includes/products_next_previous.php
<tr>
<td>
<table border="0" align="center">
<tr>
<td align="left" class="main"><a href="<? echo tep_href_link(FILENAME_PRODUCT_INFO, "products_id=$previous&cPath=$cPath"); ?>"><?php echo tep_image_button('button_prev.gif', IMAGE_BUTTON_PREVIOUS); ?></a></td>
<!-- <td align="center" class="main"><?php echo (PREV_NEXT_PRODUCT); ?><?php echo ($position+1 . "/" . $counter); ?><br><?php echo (PREV_NEXT_FROM) ?><?php echo ($category_name_row['categories_name']); ?></td> -->
<td align="center" class="main"><?php echo (PREV_NEXT_PRODUCT); ?><?php echo ($position+1 . "/" . $counter); ?></td>
<td align="right" class="main"><a href="<? echo tep_href_link(FILENAME_PRODUCT_INFO, "products_id=$next_item&cPath=$cPath"); ?>"><?php echo tep_image_button('button_next.gif', IMAGE_BUTTON_NEXT); ?></a></td>
</tr>
</table>
</td>
</tr>
With
<tr>
<td>
<table border="0" align="center">
<tr>
<td align="left" class="main"><a href="javascript:history.go(-1)"><?php echo tep_image_button('button_prev.gif', IMAGE_BUTTON_PREVIOUS); ?></a> </td>
<td align="center" class="main"><?php echo (PREV_NEXT_PRODUCT); ?><?php echo ($position+1 . " of " . $counter. " Products" ); ?><br><?php echo (PREV_NEXT_FROM) ?><?php echo ($category_name_row['categories_name']); ?></td>
<!-- <td align="center" class="main"><?php echo (PREV_NEXT_PRODUCT); ?><?php echo ($position+1 . " of " . $counter. " Products" ); ?></td> -->
<td align="right" class="main"> <a href="<? echo tep_href_link(FILENAME_PRODUCT_INFO, "products_id=$next_item&cPath=$cPath"); ?>"><?php echo tep_image_button('button_next.gif', IMAGE_BUTTON_NEXT); ?></a></td>
</tr>
</table>
</td>
</tr>
http://blackroots.net/charlie-chaplin-portraits-rascd-3318-p-1239.html
No files to upload
Version by Carl Shelbourne. I have included an install.txt file and buttons. English Only.
The contribution doesn't worked correct for me with more than 1 language.
Change after installation line 36 to this:
$sqlStr = "SELECT p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc, " . TABLE_PRODUCTS_DESCRIPTION . " as pd WHERE " . $outOfStock ."p.products_id = ptc.products_id AND ptc.categories_id = $current_category_id AND p.products_id=pd.products_id AND pd.language_id = " . (int)$languages_id ;
I liked this mod, but found a few funnies.
Fixed them.
Also, added some more functionality.
* The Next and Previous buttons now show the name of product as a tooltip.
* You can switch them off through admin if you add the 2 lines of sql provided in the one file
* Adding 'Out Of Stock' items to the loop is also possible through an admin switch.
* Next/Previous only shown if >1 product in category.
* A little more error handling
As stated earlier, I liked the original. I made this do more of what I wanted. The orignal has a few funnies, but this is not a replacement, merely an alternative. As it was entirely based on this code, I thought this the best place to publish.
This has a couple changes to how the categories are handled.
Assumes you have a button_next and button_prev
The file belongs in the /includes directory and can be called from anywhere in the product_info.php file.
Note the define statements to add to your language file(s)
Previous Next Contribution V0.2
Updated queries, they were wrong in the V0.1.
Build by Nirvana and Yoja
This contribution makes an previous and next button in the product_info.php page indepent
from where you came.
Previous Next Contribution v0.1
Build by Nirvana and Yoja
This contribution makes an previous and next button in the product_info.php page indepent from where you came.
As requested in: http://forums.oscommerce.com/viewtopic.php?t=38214
