Totally Zenned
- Join Date:
- May 2009
- Posts:
- 1,273
- Plugin Contributions:
- 3
Multi Cross Sell mod [Support thread]
Thank you.
Views: 85,108
Totally Zenned
Thank you.
Totally Zenned
Since I was translating this to Italian, I thought to edit YOUR_RENAMED_ADMIN/multi_xsell.php in order to make it easy for people to localize it by adding the defines.
I attach a copy for you, if you think could be worth for the next update; in case double check the files - they do work on my Zen Cart.
Totally Zenned
keneso:
Since I was translating this to Italian, I thought to edit YOUR_RENAMED_ADMIN/multi_xsell.php in order to make it easy for people to localize it by adding the defines.
I attach a copy for you, if you think could be worth for the next update; in case double check the files - they do work on my Zen Cart.Thank You,
I am working on a new version and will check out your suggestions.
In the meantime it should help others that use more than one language.
Totally Zenned
In thes setup using this I have a superuser (administrator), and a second user profile, for the latter I have enabled the access to catalog>>cross sell, and configuration>>cross sell settings, but when trying to access catalog>>cross sell I get the following:
"Sorry, your security clearance does not allow you to access this resource.
Please contact your site administrator if you believe this to be incorrect.
Sorry for any inconvenience."
No problem in accessing configuration>>cross sell settings
Thank you.
Totally Zenned
keneso:
In thes setup using this I have a superuser (administrator), and a second user profile, for the latter I have enabled the access to catalog>>cross sell, and configuration>>cross sell settings, but when trying to access catalog>>cross sell I get the following:
"Sorry, your security clearance does not allow you to access this resource.
Please contact your site administrator if you believe this to be incorrect.
Sorry for any inconvenience."
No problem in accessing configuration>>cross sell settingsThank you.Also a bug (sort of) 1.5 changed the way some files are defined
see post# 338
Totally Zenned
Thank you, I appreciate your patience.
Totally Zenned
I know a few people have asked how to get the cross sells to show in the shopping cart, so I thought I'd post a solution. I didn't write this from scratch, just made a few changes to an old mod (Upsells/Cross Sells in Shopping Cart). I've only tested this on v1.5.1.
Create a new file: includes/modules/YOUR_TEMPLATE/cart_upsell.php with this code:
<?php if (!defined('MAX_DISPLAY_XSELL')) define('MAX_DISPLAY_XSELL',6); if (!defined('MIN_DISPLAY_XSELL')) define('MIN_DISPLAY_XSELL',1); if (!defined('SHOW_PRODUCT_INFO_COLUMNS_XSELL_PRODUCTS')) define('SHOW_PRODUCT_INFO_COLUMNS_XSELL_PRODUCTS',3); if ($_SESSION['cart']->contents) { $i = 0; foreach($_SESSION['cart']->contents as $id => $qty) { $prod[$i] = zen_get_prid($id); $i++; } $cross_sell = 1; //check if cross_sell module installed if (@file_exists(DIR_WS_MODULES . zen_get_module_directory('multi_xsell_products.php'))) { $c = MAX_DISPLAY_XSELL; $num = round($c/sizeof($prod)); $extra = $num + 1; $max = $c; for ($i = 0; $i < sizeof($prod); $i++) { if ($i < sizeof($prod) - 1) { $cross_sell_sort_by = XSELL_SORT_ORDER . $mxsell=="sort_order"?" order by xp.sort_order asc ": " order by rand() "; $cross_sell_query_raw .= "(select p.products_id, p.products_image from " . TABLE_PRODUCTS_MXSELL . $cross_sell . " xp, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where xp.products_id = '" . $prod[$i] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $_SESSION['languages_id'] . "' and p.products_status = 1 " . $cross_sell_sort_by." limit " . MAX_DISPLAY_XSELL . ") UNION "; $c -= $num; } else { $c += 2; $cross_sell_sort_by = XSELL_SORT_ORDER . $mxsell=="sort_order"?" order by xp.sort_order asc ": " order by rand() "; $cross_sell_query_raw .= "(select p.products_id, p.products_image from " . TABLE_PRODUCTS_MXSELL . $cross_sell . " xp, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where xp.products_id = '" . $prod[$i] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $_SESSION['languages_id'] . "' and p.products_status = 1 " . $cross_sell_sort_by." limit " . MAX_DISPLAY_XSELL . ")"; } } $cross_sell_query = $db->Execute($cross_sell_query_raw); $db->Execute("create temporary table cross_sell ( products_id int(11), products_image varchar(64) )"); while (!$cross_sell_query->EOF) { $db->Execute("insert into cross_sell values('" . $cross_sell_query->fields['products_id'] . "', '" . $cross_sell_query->fields['products_image'] . "')"); $cross_sell_query->MoveNext(); } for ($i = 0; $i < sizeof($prod); $i++) { $db->Execute("delete from cross_sell where products_id = '" . $prod[$i] . "'"); } $cross_sell_query_final = "select * from cross_sell limit " . $max; $cross_sell_final = $db->Execute($cross_sell_query_final); $db->Execute("drop table cross_sell"); $num_products_cross_sell = $cross_sell_final->RecordCount(); if ($num_products_cross_sell >= MIN_DISPLAY_XSELL) { $row = 0; $col = 0; $list_box_contents = array(); $title = ''; if ($num_products_cross_sell < SHOW_PRODUCT_INFO_COLUMNS_XSELL_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_XSELL_PRODUCTS==0) { $col_width = floor(100/$num_products_cross_sell); } else { $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_XSELL_PRODUCTS); } while (!$cross_sell_final->EOF) { if (zen_has_product_attributes($cross_sell_final->fields['products_id']) or PRODUCT_LIST_PRICE_BUY_NOW == '0') { $lc_button = '<br /><a href="' . zen_href_link(zen_get_info_page($cross_sell_final->fields['products_id']), '&products_id=' . $cross_sell_final->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a><br />'; } else { $lc_button = '<br /><a href="' . zen_href_link(FILENAME_SHOPPING_CART, 'action=buy_now&products_id=' . $cross_sell_final->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) . '</a>'; } $cross_sell_final->fields['products_name'] = zen_get_products_name($cross_sell_final->fields['products_id']); $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsCrossSell centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"', 'text' => '<div class="listingProductImage" style="margin-top: 5px; margin-bottom: 5px;"><a href="' . zen_href_link(zen_get_info_page($cross_sell_final->fields['products_id']), 'products_id=' . $cross_sell_final->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $cross_sell_final->fields['products_image'], $cross_sell_final->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></div>'. (constant(CROSS_SELL.$cross_sell._DISPLAY_NAME)=='true'? '<div class="itemTitle"><h4 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($cross_sell_final->fields['products_id']), 'products_id=' . $cross_sell_final->fields['products_id']) . '">' . $cross_sell_final->fields['products_name'] . '</a></h4></div>':'').(constant(CROSS_SELL.$cross_sell._DISPLAY_MODEL)=='true'? '<div class="itemModel"><h4 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($cross_sell_final->fields['products_id']), 'products_id=' . $cross_sell_final->fields['products_id']) . '">' . zen_products_lookup($cross_sell_final->fields['products_id'], 'products_model') . '</a></h4></div>':'').(constant(CROSS_SELL.$cross_sell._DISPLAY_PRICE)=='true'? '<div class="price">'.zen_get_products_display_price($cross_sell_final->fields['products_id']).'</div>':'') .(constant(CROSS_SELL.$cross_sell._DISPLAY_BUY_NOW)=='true'? '<div class="listingBuyNowButton">'.$lc_button.'</div>':'') ); $col ++; if ($col > 2) { $col = 0; $row ++; } $cross_sell_final->MoveNext(); } $cross_sell_data = $list_box_contents; ?> <br class="clearBoth"> <div class="centerBoxWrapper" id="crossSell"> <?php require($template->get_template_dir('tpl_columnar_display.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_columnar_display.php'); ?> </div> <?php } } } ?>
Add this to your includes/templates/YOUR_TEMPLATE/templates/tpl_shopping_cart.php file wherever you want the cross sells to show up:
<?php require(DIR_WS_MODULES . zen_get_module_directory('cart_upsell.php')); ?>
That's it!
Zen Follower
What a great day. I've been searching for this fix for so long.
Completely appreciate you taking the time to post this solution.
(Might be good to pack for the Plugins section)
Any idea how I might add a line of text above the xsells on the shopping cart page, that says "We thought you might like to add..."?
I'm concerned people might think they're checking out with the item I'm recommending, instead of what they added to cart.
Or even a horizontal rule to separate...
Again, much appreciated!
Totally Zenned
Sure, just put this in the shopping_cart.tpl file:
<h2>You May Also Like...</h2> <hr/> <?php require(DIR_WS_MODULES . zen_get_module_directory('cart_upsell.php')); ?>
That's not the cleanest way to do it, but it will work for now. When I have a chance I will package it up as a mod and add language definitions, etc.
mcpisik:
What a great day. I've been searching for this fix for so long.
Completely appreciate you taking the time to post this solution.
(Might be good to pack for the Plugins section)Any idea how I might add a line of text above the xsells on the shopping cart page, that says "We thought you might like to add..."?
I'm concerned people might think they're checking out with the item I'm recommending, instead of what they added to cart.
Or even a horizontal rule to separate...Again, much appreciated!
Zen Follower
Brilliant :)
New Zenner
Hi does this module work with 1.5.3?
Regards
Paul
Totally Zenned
ptowers49:
Hi does this module work with 1.5.3?
Regards
PaulI haven't tested it yet as is.
Still on the to-do list
New Zenner
any idea on the timing for the testing as it is a good module?
Regards
Paul
Totally Zenned
ptowers49:
any idea on the timing for the testing as it is a good module?
Regards
PaulProbably 4 to 5 weeks as I have lot on at the moment.
It will include a few small fixes for php and mysql changes as well
Zen Follower
Hey guys can I ask is cross sell the same as linking pages in the eyes of google or not ..Just wondering that's all as a lot of my products are used in this way
thanks
New Zenner
I am having an odd problem with this mod. Not sure when it started, but I noticed today that Cross Sell is not showing on the product page. I uninstalled/re-installed, added the display code to default template and switched templates in Admin, but it's still a no-show. Any ideas as to what may be causing this?
Totally Zenned
k1ra:
I am having an odd problem with this mod. Not sure when it started, but I noticed today that Cross Sell is not showing on the product page. I uninstalled/re-installed, added the display code to default template and switched templates in Admin, but it's still a no-show. Any ideas as to what may be causing this?Please reply and answer the posting tips at the top of page including what version of zen-cart?
What version of this mod?
What version of php?
And a link to a product that should normally show cross sells?
Totally Zenned
I saw the tip on how to put xsell items on cart page, upsell style. did anybody create a complete solution? It works to just display xsell item pictures below the cart but the Cross Sell Settings in admin like price or buy now button do not show up. Anybody done that?
New Zenner
ilmarchez:
Hi, I've installed 1.02 on Zencart 1.3.9h it works but I have a problem:
- the header of each cross sell soes not show up (like "Suggested Matching Items...")
- how and where could I change this title?
You can see it in action here: http://tinyurl.com/d5h768d
Thanks for your help!
Stefano
I am having the same problem..."Suggested Matching Items..." is not showing up on my module. Any suggestions?
Thanks
Totally Zenned
amandarm:
I am having the same problem..."Suggested Matching Items..." is not showing up on my module. Any suggestions?
Thanks
Please reply and answer the posting tips at the top of page including what version of zen-cart?
What version of this mod?
What version of php?
And a link to a product that should normally show cross sells?
Fields marked required must be completed.
Tell staff why this post should be reviewed.
Required for login, security, and core site functionality.
Help us understand how the site is used so we can improve it.
Used for promotion and personalized campaign measurement.