Community Add-Ons
X-Sell v2-MS2 - Cross Sell for MS2
for osCommerce Online Merchant v2.2
Updated catalog and Admin files for Cross-sell. Works with MS2.
Cross-sell allows you to link products to each other to upsell /suggest items customers might also wish to purchase.
There is an error in $xsell_query in the file includesmodulesxsell_products.php:
....IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, specials_new_products_price.....
this gives wrong specials_new_products_price. It gives specials_new_products_price even if the status of special product is 0
IT MUST BE ONLY:
....IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price.....
NOT FULLY PACKAGE, JUST ONLY includesmodulesxsell_products.php
If you have not made any changes, you can just replace file.
The content of the xs_autoinstaller/index.php file was moved to control.php to make the php version check work.
Autoinstaller 2.14 for Cross-Sell (XSell) Module v2.6 by Amandus (14 Mar 2009)
The Auto Installer script requires PHP 5.2.0
Download the package and view the screenshots of what you will get after the installation.
Autoinstaller 2.14 for Cross-Sell (XSell) Module v2.6 by Amandus (14 Mar 2009)
The script automatically install the contribution: copy files, edit files, alter database tables.
It saves a backup before any action.
The Auto Installer script requires PHP 5.2.0
Download the package and view the screenshots of what you will get after the installation.
Autoinstaller 2.13 for Cross-Sell (XSell) Module v2.6 by Amandus (14 Mar 2009)
The script automatically install the contribution: copy files, edit files, alter database tables.
It saves a backup before any action.
The Auto Installer script requires PHP 5.2.0
Download the package and view the screenshots of what you will get after the installation.
FULL PACKAGE with UPDATE instructions
Since v2.6 from olsonsp4c (below)
-----------
* Added german language files
* Added german sql-file
* Added some screenshots
* Corrected some pathes in installation.txt
* Maked some optical changes in admin section
Amandus
FULL PACKAGE with UPDATE instructions
Since v2.5.x
------------
* Updated code for reciprocal xsell entries (thanks pedro.antunes)
* Added Portuguese language for admin (thanks pedro.antunes)
* Updated Step 14 for correct redirection of buy now button to product
so that all product ids are not the same product id after a product
is added to the shopping cart using the buy now button in the product
listing when redirect to shopping cart is set to "false"
* Corrected small typos in instructions
* Corrected the reset cache in admin to work properly AND display properly
* Corrected new image in admin to display properly
Scott
Included in this package:
- Portuguese language traslation
- Cache reset bugfix instructions from boutique-studio (already applied on admin/xsell.php)
- added the picture in the Cross-Sell Admin
- new cross-sells are now added in both directions (i.e. from Product A to B and from Product B to A). No need to add it manually.
- bug corrected: product model was no being shown when editing cross-sells and priorities.
Enjoy!
Note: I had not seen olsonsp4c post before I sent mine. Don't know whats the difference...
FULL PACKAGE with UPDATE instructions
All the Changes since v2.4
----------------------------
* Search field added
* Prices fixed
* Image too big issue fixed
* Updated a few files for rc2a compliance
* Updated the installation instructions for rc2a
* Fixed a few small language file edits
* Added Search capability file
* Updated sql to include a maximum display entry exclusively for cross sell (not relying on also purchased setting any longer)
* Images were not working at all in admin listings, this is now fixed
* Many cosmetic changes in admin/xsell.php
* Corrected cache system to actually work (standard osC) [previous fixes did not work properly]
* Integrated Change log into installation instructions
Scott
The cache block reset doesn't work for xsell_products. The attached file describes how to fix this.
FULL PACKAGE with UPDATE INSTRUCTIONS
(ignore the previous package please)
Since v2.4
-----------
updated for rc2a and fixed a few small language file edits mentioned below + added Search capability file mentioned below
updated sql to include a maximum display entry exclusively for cross sell (not relying on also purchased setting any longer)
images were not working at all in admin listings, this is now fixed
many cosmetic changes in admin/xsell.php
Scott
Modified catalog/admin/xsell.php for better readability and asthetics and added functionality to fill in the model number with "--none--" if there is no model number for a particular product.
FULL PACKAGE with UPDATE INSTRUCTIONS
Scott
updated for rc2a and fixed a few small language file edits mentioned below + added Search capability file mentioned below
updated sql to include a maximum display entry exclusively for cross sell (not relying on also purchased setting any longer)
Support forum: http://forums.oscommerce.com/index.php?showtopic=34799
Scott
The image display have some issue from admin/xsell.php
you can look for "SMALL_IMAGE_WIDTH" , add adding
"",
before it, total 4 place.
The attached is update xsell.php based x-sell 2.4
Prices now show correctly.
At the end of admin/includes/languages/english/xsell.php just before ?>
Add:
define('HEADING_TITLE_SEARCH', 'Search:');
Added a search field, which was much needed.
- Removed Maxime cache system (sorry mate!) and now using a standard Osc cache system base on the product/language & currency. For this cache I also made use of contribution http://www.oscommerce.com/community/contributions,5108 that rewrite the tep_reset_cache_block function in a more efficent manner.
- Added 2 indexes to the xsell table creation.
-Removed reference to enable/disable categorie & SPPC as well as unused files.
- Optimized the module queries by using outer join and removing call to the tep_get_products_special_price.
- Included a fix found on the forum for the redirection when clicking on the buy_now button on a linked product.
- Changed Admin Xsell to display images on all pages. Also fixed problem with image path that could link to always display "No images"
- Xsell admin Price is now shown including tax as well as specials price if exists.
Tested on 2.2RC1
I am using an older version of Cross Sell, and I'm not sure which version, but I wanted to post this because it's such an improvement.
The Edit page becomes very unmanageable when you have lots of items in your store. This modification makes it so that the products are 5 columns across, rather than 1. This modification also will allow you to click the product image to select for Cross Sell, rather than just the checkbox.
TO INSTALL:
1. BACK UP! I have no idea which version of the Addon I'm using.
2. Near Line 181, find the code starting with
// This bit does the 'EDIT' page (previously Add/Remove)
and ending with
//////////////////////////////////////////////////////////////////////////////////
// This bit does the 'PRIORITISE' page (previously Sort)
3. Replace with the following:
//////////////////////////////////////////////////////////////////////////////////
// This bit does the 'EDIT' page (previously Add/Remove)
if ($_POST && !$sort)
{
if ($_POST[run_update]==true)
{
$query ="DELETE FROM " . TABLE_PRODUCTS_XSELL . " WHERE products_id = '".$_POST[add_related_product_ID]."'";
if (!tep_db_query($query))
exit('could not delete');
}
if ($_POST[xsell_id])
foreach ($_POST[xsell_id] as $temp)
{
$query = "INSERT INTO " . TABLE_PRODUCTS_XSELL . " VALUES ('',$_POST[add_related_product_ID],$temp,1)";
if (!tep_db_query($query))
exit('could not insert to DB');
}
echo '<a href="' . tep_href_link(FILENAME_XSELL_PRODUCTS, '', 'NONSSL') . '">Click Here to add a new cross sale</a><br>' . "n";
if ($_POST[xsell_id])
echo '<a href="' . tep_href_link(FILENAME_XSELL_PRODUCTS, 'sort=1&add_related_product_ID=' . $_POST[add_related_product_ID], 'NONSSL') . '">Click here to sort (top to bottom) the added cross sale</a>' . "n";
}
if ($add_related_product_ID && ! $_POST && !$sort)
{ ?>
<table border="0" cellpadding="2" cellspacing="1" bgcolor="#999999">
<form action="<?php tep_href_link(FILENAME_XSELL_PRODUCTS, '', 'NONSSL'); ?>" method="post">
<?php
$query = "select b.language_id, a.products_id, b.products_name, b.products_description, " .
"a.products_quantity, a.products_model, a.products_image, a.products_status, " .
"b.products_url, a.products_price from products a, products_description b where b.products_id = a.products_id and b.language_id = 2 and a.products_id = '".$add_related_product_ID."' AND a.products_status = 1";
list ($language_id, $PRODUCTS_id, $PRODUCTS_name, $PRODUCTS_description , $PRODUCTS_quantity , $PRODUCTS_model , $PRODUCTS_image , $PRODUCTS_url , $PRODUCTS_price, $PRODUCTS_status ) = general_db_conct($query);
echo '<span class="pageHeading">Setting cross-sells for: ' . $PRODUCTS_model[0] . ' (Product ID: ' . $PRODUCTS_id[0] . ') <br><br>' . tep_info_image($PRODUCTS_image[0], $PRODUCTS_name[0], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</span><br><br>';
?>
<?
//changed order by a.products_id to a.products_model below
$query = "select b.language_id, a.products_id, b.products_name, b.products_description, " .
"a.products_quantity, a.products_model, a.products_image, " .
"b.products_url, a.products_status, a.products_price from products a, products_description b where b.products_id = a.products_id and b.language_id = 2 and a.products_id != '" . $add_related_product_ID . "' and a.products_status = 1 ORDER BY a.products_model";
list ($language_id, $PRODUCTS_id, $PRODUCTS_name, $PRODUCTS_description , $PRODUCTS_quantity , $PRODUCTS_model , $PRODUCTS_image , $PRODUCTS_url , $PRODUCTS_status, $PRODUCTS_price ) = general_db_conct($query);
$num_of_products = sizeof($PRODUCTS_id);
$query = "select * from " . TABLE_PRODUCTS_XSELL . " WHERE products_id = '" . $add_related_product_ID . "'";
list ($ID_PR, $PRODUCTS_id_PR, $xsell_id_PR) = general_db_conct($query);
$num_of_products = sizeof($PRODUCTS_id);
echo '<p>There are '.$num_of_products.' available cross-sell products</p>';
$a = 0;
for ($i=0; $i < $num_of_products; $i++)
{
if($a == 0) { echo ' <tr bgcolor="#DFE4F4">'; }
echo "<td class="dataTableContent" align='center' style='padding:5px;'>"
. '<label onMouseOver="this.style.cursor='pointer'; this.style.cursor='hand'">'
. tep_info_image($PRODUCTS_image[$i], $PRODUCTS_name[$i], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)
. '<br />'. '<strong>ID:</strong> '.$PRODUCTS_id[$i]
. '<br />'. '<strong>Model #:</strong> '. $PRODUCTS_model[$i]
. '<br />'. '<strong>Price:</strong> ' . $currencies->display_price($PRODUCTS_price[$i], tep_get_tax_rate($product_info_values['products_tax_class_id'])); ?>
<br /><input onMouseOver="this.style.cursor='pointer'; this.style.cursor='hand'"
<?php /* See if item is in the DB. Display and set checkbox. */
// Adam@CP: Changed order of columns.
$run_update = false; // Set False to insert new entry in the DB
if ($xsell_id_PR)
foreach ($xsell_id_PR as $compare_checked)
if ($PRODUCTS_id[$i] === $compare_checked) {
echo "checked ";
$run_update = true;
}
?>
size="20" name="xsell_id[]" type="checkbox" value="<?php echo $PRODUCTS_id[$i]; ?>">
Cross-sell</label>
<? echo "</td>n";
$a++;
if($a == 5) { echo '</tr>'; $a = 0;}
} // end for num_of_products
?>
<tr>
<td colspan="4">
<input type="hidden" name="run_update" value="<?php if ($run_update==true) echo "true"; else echo "false" ?>">
<input type="hidden" name="add_related_product_ID" value="<?php echo $add_related_product_ID; ?>">
<input type="submit" name="Submit" value="Submit">
</td>
</tr>
</form>
</table>
<? }
// sort routines
if ($sort==1)
{
// first lets take care of the DB update.
$run_once=0;
if ($_POST)
foreach ($_POST as $key_a => $value_a)
{
tep_db_connect();
$query = "UPDATE " . TABLE_PRODUCTS_XSELL . " SET sort_order = '" . $value_a . "' WHERE xsell_id= '$key_a' ";
if ($value_a != 'Update')
if (!tep_db_query($query))
exit('Could not UPDATE DB');
else if ($run_once==0)
{
echo '<b class='main'>Cross-sells updated <a href="' . tep_href_link(FILENAME_XSELL_PRODUCTS, '', 'NONSSL') . '">Back to cross-sell admin</a></b><br>' . "n";
$run_once++;
}
}// end of foreach.
On my installation, with SEO URLS, the Buy It Now button was showing the parent product's ID and not its own.
In catalog/includes/modules/xsell_products.php
//Cache
$text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']) . '">' . $xsell['products_name'] .'</a><br>' . $xsell_price. '<br><a href="' . tep_href_link(FILENAME_DEFAULT, 'action=buy_now&products_id=' . $xsell['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $xsell['products_name'] . TEXT_NOW) .'</a>';
I stripped out the
tep_get_all_get_params(array('action')) .
and it seems to work.
As I am not a great expert at this, do please test the heck out of it before you go anywhere near a production system!
This zip contains only the updated includes/modules/xsell_products.php file.
The admin/xsell.php file incorrectly refers to the images directory using the prefix '../images'. This doesn't cause a problem if you happen to install osC with the admin directory below the catalog directory. (This is not a good idea, by the way, in my opinion. You should never have admin programs in a well known place even if they are password protected.)
The attached file describes how to fix this by substituting the proper prefix using DIR_FS_CATALOG_IMAGES or DIR_WS_CATALOG_IMAGES.
Just a small update to clearly explain the path for cache function to work properly.
All creds to the creators of this great and useful contribution!
This is full package (with image fix).
I added cache system. This package contain enabled / disabled categories queries for X-sell.
I have fix the image problem,
Images are now in 100*100
Copy the file into Admin/
Backup Backup
Xpdream.com
Complete package, the previously posted one could cause some problems with additional class.
This complete package includes final and working fix for "Buy Now" button. Previously published fix didn't work due to 2 product_id's in the URL.
Little Fix for hide headers...forgotten ")"
Just instructions on how to edit the /includes/modules/xsell_products.php
to get the box header to not display when there are no cross sell products assigned.
I basically inserted a counter to see if any are then. Then I moved the display of the header to the end of the module right before the xsells are output.
Iīm sorry!
Donīt follow previous by me.
Stupid :-(
Try this.
Replace the catalog/includes/modules/xsell_products.php file.
Hi all, just wanting to know if there is a bug fix for this? the Header tag shows up when the product has no cross sell items.
(As attached)
Thanks Craig
This is an add-on for cross sell module to define x-sell products on product add/edit page in admin.
We will se this message if we turned on the E_NOTICE option in error_reporting
Notice: Use of undefined constant MIN_DISPLAY_XSELL - assumed 'MIN_DISPLAY_XSELL' in /var/www/html/boutique3/includes/modules/xsell_products.php on line 31
You should change the line 31:
if ($num_products_xsell >= MIN_DISPLAY_XSELL) {
into:
if ($num_products_xsell > 0) {
No credit due for this one, just really frustrating on a contrib like this trying to figure out which files to download. Now all files have been put into one folder with the latest version of every file from the various alterations below. This package has the admin and catalog end, all languages so far supported and the buy_now mod included. Enjoy, and I hope I have saved at least one person a couple of minutes of confusion!
I've added a missing instruction into /catalog/includes/modules/xsell_products.php
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_XSELL_PRODUCTS);
I've made all translations into French language.
Every thing OK until we change the sort order for X-Sell items: there is a small text "Setting cross-sells for:" is still in English
To fix this bug, open the file /catalog/admin/xsell.php
Goto the line 266..
View the detail in changelog.txt
Modified by Janz & Marvin Miller
February 25, 2005
This contains a modified xsell_products.php that works with the New Separate Price Per Customer 4.0 release http://forums.oscommerce.com/index.php?showtopic=53436&view=findpost&p=556240
The xsell_products.php file includes code for buynow and correctly pulls the proper price depending on the group the customer belongs to.
It also contains a bug-fix for the sort option in the admin (prioritize) and that now works as well.
An original non-buy now xsell_products.php was not included as it wasn't a priority for me.
If you have this same version installed previously you only need to upload the xsell_products.php (catalog/languages/english/xsell_products.php) file to make it work with the New Spearate Price
It's built off of Aaron Hiatt's modified contribution (8 Jun 2004 - X-Sell v2.02 for MS2.2) so newer features in later releases may not work for you.
This is a modification to the existing X-Sell Module that makes possible to search through products in popup window (file validproducts.php).
Contribution contain only changed file.
To install - replace corresponding file on X-Sell Module.
simple change to add a buy now button under xsell items while displaying xsell items similar to other products - other option was to allow for a checkbox to add item with item above to cart however - i needed the option to display more than 1 item as more of a comparison instead of "upselling" with the item above. So now when xsell item is displayed - a buy now is available so that one or the other item is added to the cart.
screenshot included
This is an update which adds complete language support for german and turkish in the admin's and catalog's part.
Thanks to all persons who made this modul available.
Hello,
found something i believe to be a syntax error, after correcting this, the mod seems to work :-) Never did anything with php, so it was trial and error...
Also included german and hungarian languagefiles.
If you are using the Separate Pricing Contribution then you will want to download this file. Currently, no matter what price level your customer has, they would only see "List" price for the xsell models. I have re-written the xsell module so that it complies with the Separate Pricing Contribution. Now the cost shown will be the actual price for that customer's price level, not the "List" price. It will default to "List" price if the customer is not logged in.
This file is only an updated version of the install file for the catalog section. There was an error in the code resulting in the product_info page having a parse error. Please download the previous full version and replace the install file for the catalog section with this file.
I have completely rewritten the admin area for this module to be multilingual and to split the page results for products and for adding cross sells, a feature i think everyone has been waiting for, also the file is easier to understand and to add to if you want, it is set to the max search results which most of the time is 20 so i left it how it was enjoy guys, and if you already have x-sell installed, no problem just copy the xsell.php and change your FILENAME_XSELL_PRODUCTS define to xsell.php and its ready to go.
Thanks for the language help - I can't test that either tho! Hope it works :)
Other changes..
Main page:
- Renamed 'Sort' to 'Prioritise'. I prefer it that way: YMMV.
Edit page:
- Fixed 'Cross sell this?' checkboxes not being checked when a cross-sell is active (important issue!)
- Added thumbnail of the product being edited to the top.
- Added thumbnails of all products available for cross-sell (won't be good for long listings, but mine aren't :)
- Changed sort order of listing from Product Name to Model Number.
- Added a hand cursor over the 'Cross-sell this?' checkbox and label.
Sort page:
- Added title and thumbnail of product you're editing to the top of the page
- Added thumbnails to the product listing
- Moved the changelog from the top of the file to Changelog.txt
- Cleaned up the zip. Made dir's all lowercase, renamed the install text help files to install.txt
There's still quite a way to go before the admin interface for this is perfect, but what's here basically works and gets the job done.
This should now offer all functions. Even multiple languages. Although I have not tested this functionality.
Here is an updated file one only. It should go in the admin directory of your web site(s).
Same as previous version, with these improvements (imho):
On main listing of all items cross-sells (first page):
- Added Model Number column into table ('Quickfind code' column)
- Added the Model Number to each items list of cross-sold products ('Current cross-sells' column)
- Added ability to click table rows to Edit cross-sells. Switches to Hand cursor on mouseOver.
- Changed 'Add' and 'Remove' cross-sell to 'Edit'
- Renamed 'Sort' to 'Prioritise'
On a product's 'Edit Cross-sells' page
- Added a Page Title showing model number (Quickfind) and product ID
- Added Model Number column into table ('Quickfind code' column)
- Changed column order to make more usable
- Added <label> round checkboxes to increase mouse target area
Plus various minor bugfixes.
Updated catalog and Admin files for Cross-sell. Works with MS2.
Cross-sell allows you to link products to each other to upsell /suggest items customers might also wish to purchase.
