Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Cross Sell (X-Sell) Admin


dreamscape

Recommended Posts

Emmm... See catalog\includes\modules\xsell_products.php file and find constants like TEXT_BUY and TEXT_NOW. Change them and code between them. To change constants itself find them in your language file (ex. catalog\includes\languages\english.php). You also may replace this two with another one, giving it a unique name, eg.:

define('TEXT_XSELL_ADD_TO_CART', 'Add to Cart');

Link to comment
Share on other sites

I'm not great with PHP can you just tell me how to remove everything and just leave buy now, I have something like this:

$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_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=buy_now&product_to_buy_id=' . $xsell['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $xsell['products_name'] . TEXT_NOW) .'</a>'

Edited by ronin13
Link to comment
Share on other sites

Very interesting. Your code is default for xsell contrib. But text on a button is the text of a button "alt" tag. Please say, is all your buttons are text or images? Seems you have a plugin that do such a convertation.

Try to modify your code to following and see the result. If buttons begin smaller in size, let me know, we modify other text. Don't forget to reset the cache if using it!

 

Replace your code with:

$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_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=buy_now&product_to_buy_id=' . $xsell['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . TEXT_NOW) .'</a>';
Edited by RusNN
Link to comment
Share on other sites

  • 3 weeks later...

I have install XSell version 2.7.2, but have a couple of changes I would like to make, if they are easy to do, and someone could suggest what would have to be changed in order for it to work. How can I randomize the results displayed, so the same products are not displayed every time. In addition, how can I only display item currently in-stock.

Link to comment
Share on other sites

I have install XSell version 2.7.2, but have a couple of changes I would like to make, if they are easy to do, and someone could suggest what would have to be changed in order for it to work. How can I randomize the results displayed, so the same products are not displayed every time. In addition, how can I only display item currently in-stock.

To do all of this you need just to modify a query in catalog\includes\modules\xsell_products.php.

1. Find in the query

order by sort_order asc limit " . MAX_DISPLAY_XSELL);

and replace with

order by rand() limit " . MAX_DISPLAY_XSELL);

This is not very good, because such construction need a lot of memory, it is slow. But this is the fastest way.

Oh! Don't forget to disable cache! Or your xsell will stay the same for a couple of time.

 

2. If products not in stock AND their status set to 0 (false), than they doesn't display. But if you don't disable such products, like me, you need to insert

" and p.products_quantity > 0 "

without quotes, but surrounding with spaces just before

order by sort_order asc limit " . MAX_DISPLAY_XSELL);

in the same query as above.

 

Not tested, seems will work. As if having problems.

Link to comment
Share on other sites

To do all of this you need just to modify a query in catalog\includes\modules\xsell_products.php.

1. Find in the query

order by sort_order asc limit " . MAX_DISPLAY_XSELL);

and replace with

order by rand() limit " . MAX_DISPLAY_XSELL);

This is not very good, because such construction need a lot of memory, it is slow. But this is the fastest way.

Oh! Don't forget to disable cache! Or your xsell will stay the same for a couple of time.

 

2. If products not in stock AND their status set to 0 (false), than they doesn't display. But if you don't disable such products, like me, you need to insert

" and p.products_quantity > 0 "

without quotes, but surrounding with spaces just before

order by sort_order asc limit " . MAX_DISPLAY_XSELL);

in the same query as above.

 

Not tested, seems will work. As if having problems.

 

Thank you, it works.

 

You did mention that I would have to disable cache, but I currently need to have cache on to cut down on server load. Is there a way to leave caching on, but have the 'we also recommend' box of items not be cached and change everytime the page is re-called

Edited by c1badmofo
Link to comment
Share on other sites

Thank you, it works.

 

You did mention that I would have to disable cache, but I currently need to have cache on to cut down on server load. Is there a way to leave caching on, but have the 'we also recommend' box of items not be cached and change everytime the page is re-called

Yes. You may run xsell box withiout cache system.

Find in catalog\product_info.php something like that:

    if ((USE_CACHE == 'true') && empty($SID)) {
     echo tep_cache_xsell_products(3600); //added for Xsell
     echo tep_cache_also_purchased(3600);
   } else {
     include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); //added for Xsell
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }

and REPLACE with

    if ((USE_CACHE == 'true') && empty($SID)) {
     echo tep_cache_also_purchased(3600);
   } else {
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
   include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); //added for Xsell

Now you xseel will randomly displayed on every page load. Cache system for xsell will not work. So ther server load will rise.

Unfortunatelly there is no way to use both the cache and random xsell on every page load at one time.

Link to comment
Share on other sites

  • 1 month later...

Somebody knows how to show the x-sell products as a list?

 

instead of rows (3x2)

 

Would be very cool if it's a list with a radio button to select the quantity you would buy

so you could add like 6 products in 1 time to your basket

 

Any Keep up the good work!

Edited by D-Flxz
Link to comment
Share on other sites

  • 1 month later...

I got it all installed and looks like its going to work fine. I have 520 pages as of today though how ever. Is there any easier way to find the products or to grab 'x' number at a time? Reason I ask is we do lots of photos. So maybe I can grab one group and just add the say.... 8x10 frames I want to xsell? I tried to grab a model number but it doesn't find it when I hit enter.

 

Thanks guys!

Link to comment
Share on other sites

One more question I'm noticing a lot of my product is missing. It seems about the time I started using Easy Populate...those products don't show. Does that sound right? Or should that not be happening? I have like 7000 items in the store but only 4000 show on this xsell listing.

Link to comment
Share on other sites

One more question I'm noticing a lot of my product is missing. It seems about the time I started using Easy Populate...those products don't show. Does that sound right? Or should that not be happening? I have like 7000 items in the store but only 4000 show on this xsell listing.

 

Ignoring this one I was wrong lol I'm figuring it out. I see that its alphabetical from the model numbers.... still if its possible to do a mass selection type thing that'd be awesome! One other thing though I'm not having the box 'white' background on my recommendation products... playersink.com/product_info.php?products_id=6351 ..... any ideas why?

Edited by Jan Zonjee
Link to comment
Share on other sites

  • 3 weeks later...

Hello,

 

I've just install version 2_7_3.

 

When i cross-sell products in Admin->Catalog/Cross Sell Products i only get the message: "Sort Order Successfully Update For Cross Sell Product #166", but there are no inputs in the database. If i manualy input records in the database table, the contribution works.

 

I'm thinking the problem is in Catalog/Admin/xsell.php, but i need help to identify it.

 

All the files are exactly like in the addon archive. The only modification is:

Find in catalog\product_info.php something like that: 
   if ((USE_CACHE == 'true') && empty($SID)) {
     echo tep_cache_xsell_products(3600); //added for Xsell
     echo tep_cache_also_purchased(3600);
   } else {
     include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); //added for Xsell
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
and REPLACE with 
   if ((USE_CACHE == 'true') && empty($SID)) {
     echo tep_cache_also_purchased(3600);
   } else {
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
   include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); //added for Xsell

Link to comment
Share on other sites

Sorry to everybody. I'm forgot to watch this topic.

 

 

Somebody knows how to show the x-sell products as a list?

 

instead of rows (3x2)

Everything is possible. But such modification is out of my time. You need to rewrite catalog\includes\modules\xsell_products.php and possibly add one other variable passing it to application_top if you want to get a quantity of choosen xsell add to a cart.

 

 

 

 

Ignoring this one I was wrong lol I'm figuring it out. I see that its alphabetical from the model numbers.... still if its possible to do a mass selection type thing that'd be awesome! One other thing though I'm not having the box 'white' background on my recommendation products... playersink.com/product_info.php?products_id=6351 ..... any ideas why?

Emm.. I'm sorry about, but I don't understand about white background. And do you mean you need sorting by columns feature?

 

 

 

When i cross-sell products in Admin->Catalog/Cross Sell Products i only get the message: "Sort Order Successfully Update For Cross Sell Product #166", but there are no inputs in the database. If i manualy input records in the database table, the contribution works.

Possibly the 2.7.3 and latest update is full admin-side rewrite of xsell and I gues it is not carefully tested. I'd recommend to use stable 2.7.2 version.

Link to comment
Share on other sites

Possibly the 2.7.3 and latest update is full admin-side rewrite of xsell and I gues it is not carefully tested. I'd recommend to use stable 2.7.2 version.

Hi!

Somehow 2.7.3 might have some little mistakes. I installed it but cross selled products could not be updated at all. Everything was there, but somehow the database could not be updated through the admin control panel. So, i deleted everything that had to do with 2.7.3 and installed 2.7.2 from scratch. Now, in the admin control panel everything seems to work perfectly, but my site has crushed!!! (HTTP 500 Internal Error). I am checking all day if i have done something wrong, but no result yet.

 

What could possibly crush my site, but the admin control panel works fine? (including the cross-sell procedure)

Link to comment
Share on other sites

Emm.. I'm sorry about, but I don't understand about white background. And do you mean you need sorting by columns feature?

 

I'm having a problem with the background of the mod for the x-sell. Maybe I'm calling it the wrong thing...? but it's that part in red I'm speaking off. It's suppose to look like the other modules like the one above it correct?? I've been able to fix up certain add-ons and get it set up but not sure how to work it on this one at all.

 

Thanks bud! Be a huge thing to get this figured out :)

 

background.jpg

 

Oh almost forgot....the columns thing. It just took me a second to figure out it was sorted be the model number alphabetically. So it's a bit easier. but we have like 4400 items and would like to use this add-on on all them so it'll take a while so didn't know if there was a way to select a bunch of items at once and add a certain item into the x-sell to that group? Doesn't look like it's an option and it's ok if it's not.

Edited by sourpickles
Link to comment
Share on other sites

Hi!

Somehow 2.7.3 might have some little mistakes. I installed it but cross selled products could not be updated at all. Everything was there, but somehow the database could not be updated through the admin control panel. So, i deleted everything that had to do with 2.7.3 and installed 2.7.2 from scratch. Now, in the admin control panel everything seems to work perfectly, but my site has crushed!!! (HTTP 500 Internal Error). I am checking all day if i have done something wrong, but no result yet.

 

What could possibly crush my site, but the admin control panel works fine? (including the cross-sell procedure)

HTTP 500 is internal server error appears due to errors in source code. You should check installation of client side of the shop (if admin works correctly). Definitely you've made a mistake and some are very difficult to find quickly because they looks like OK. If you use IE, try to open your site in Opera or FireFox. This browsers often shows the error. Or you may see into server logs. Other way is to take your backup copy of modified files and carefully compare them with your current to found mistake. Hope, you have a backup!

Link to comment
Share on other sites

I'm having a problem with the background of the mod for the x-sell. Maybe I'm calling it the wrong thing...? but it's that part in red I'm speaking off. It's suppose to look like the other modules like the one above it correct?? I've been able to fix up certain add-ons and get it set up but not sure how to work it on this one at all.

Seems like you use another BOX class in the catalog\includes\modules\xsell_products.php than in other modules. Check near bottom of the file. You should have something like

new contentBox($info_box_contents);

If it is not so, try to replace your current code with above. I recommend before you do that, to see into other modules and replace with the code like in that modules.

 

Oh almost forgot....the columns thing. It just took me a second to figure out it was sorted be the model number alphabetically. So it's a bit easier. but we have like 4400 items and would like to use this add-on on all them so it'll take a while so didn't know if there was a way to select a bunch of items at once and add a certain item into the x-sell to that group? Doesn't look like it's an option and it's ok if it's not.

Near line 183 find

    $products_query_raw = 'select p.products_id, p.products_model, p.products_price, p.products_tax_class_id, p.products_image, pd.products_name, p.products_id from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" and pd.products_name like "%' . tep_db_input($search) . '%" order by pd.products_name asc';}else{$products_query_raw = 'select p.products_id, p.products_model, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_id from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" order by pd.products_name asc';}

and REPLACE with

    $products_query_raw = 'select p.products_id, p.products_model, p.products_price, p.products_tax_class_id, p.products_image, pd.products_name, p.products_id from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" and (pd.products_name like "%' . tep_db_input($search) . '%" or p.products_model like "%' . tep_db_input($search) . '%") order by pd.products_name asc';}else{$products_query_raw = 'select p.products_id, p.products_model, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_id from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" order by pd.products_name asc';}

 

Near line 278 find

      $products_query_raw = 'select p.products_id, p.products_image, p.products_model, p.products_price, pd.products_name from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" and pd.products_name like "%' . tep_db_input($search) . '%" order by pd.products_name asc';}else{$products_query_raw = 'select p.products_id, p.products_image, p.products_model, pd.products_name, p.products_price from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" order by pd.products_name asc';}

and REPLACE with

      $products_query_raw = 'select p.products_id, p.products_image, p.products_model, p.products_price, pd.products_name from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" and (pd.products_name like "%' . tep_db_input($search) . '%" or p.products_model like "%' . tep_db_input($search) . '%") order by pd.products_name asc';}else{$products_query_raw = 'select p.products_id, p.products_image, p.products_model, pd.products_name, p.products_price from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" order by pd.products_name asc';}

After such modification you may now search by product name and by product model. Very quick mod. For 2.7.2 only.

Edited by RusNN
Link to comment
Share on other sites

Seems like you use another BOX class in the catalog\includes\modules\xsell_products.php than in other modules. Check near bottom of the file. You should have something like

new contentBox($info_box_contents);

If it is not so, try to replace your current code with above. I recommend before you do that, to see into other modules and replace with the code like in that modules.

 

Yea I have that and I have that in other modules such as new_products2 and the like in the same location folder. If it means anything I had the same problem with the multi-image add on. Couldn't ever figure out white I was missing the boxes. Any other ideas? Cause I'm obviously at a loss...

Link to comment
Share on other sites

I've just installed version 2_7_3 (3 Jun 2010) and no luck, it acts like with version 2_7_3. In gives me the "ok" mesage: Sort Order Successfully Update For Cross Sell Product #165 but it doesn't insert any rows in the products_xsell table. If i manualy insert values in the table then it will display the cross-linked products.

 

I can create new products so there is no problem with the database writing permision.

 

I've then installed version 2_7_2 (7 Apr 2010) and it works corectly! Somebody should modify the contribution 2_7_3 zip's or at least should post a mesage until they manage to get it to work corectly.

 

Thank you for your help.

Edited by FlorinRO
Link to comment
Share on other sites

Yea I have that and I have that in other modules such as new_products2 and the like in the same location folder. If it means anything I had the same problem with the multi-image add on. Couldn't ever figure out white I was missing the boxes. Any other ideas? Cause I'm obviously at a loss...

Very strange. See on how this is done in boxes like Categories, Search tags, Featured Products on your site. All of them have CSS class infoBoxContents_table in the body, but We also Recommend does not. You also may to add style manually, but in the moment I can't test to advice you right place for changes.

Link to comment
Share on other sites

I've then installed version 2_7_2 (7 Apr 2010) and it works corectly! Somebody should modify the contribution 2_7_3 zip's or at least should post a mesage until they manage to get it to work corectly.

Version 2.7.3 is completely new and untested. I can't and will not support it. If new releases become they will be based on 2.7.2.

 

To all

Please, don't use any of version 2.7.3 of this contrib. It is unstable and unsupported.

Stable version is 2.7.2 from 7 April 2010

Peter aka RusNN

Link to comment
Share on other sites

Very strange. See on how this is done in boxes like Categories, Search tags, Featured Products on your site. All of them have CSS class infoBoxContents_table in the body, but We also Recommend does not. You also may to add style manually, but in the moment I can't test to advice you right place for changes.

 

Yes I don't see that string in any of the others. Here's what my 'Featured.php' looks like...

 

 

<?php

/*

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

 

Featured Products V1.1

Displays a list of featured products, selected from admin

For use as an Infobox instead of the "Feature" Infobox

*/

 

if ($random_product = tep_random_select("select p.products_id, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, pd.products_name

from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "'

left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id

left join " . TABLE_FEATURED . " f on p.products_id = f.products_id

where p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS)) {

 

?>

<!-- featured_products //-->

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_FEATURED);

 

new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_FEATURED_PRODUCTS));

 

if (tep_not_null($random_product['specials_new_products_price'])) {

$new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>';

$new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';

} else {

$new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));

}

 

$info_box_contents = array();

$info_box_contents[] = array('align' => 'center',

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $new_price);

 

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- featured_products_eof //-->

<?php

}

?>

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