Jump to content
dreamscape

[Contribution] Cross Sell (X-Sell) Admin

Recommended Posts

After updating a shops php 5.2.* to php version 5.3.13 I am getting these errors pertaining to xsell after doing a product edit:

 

 

Warning: Invalid argument supplied for foreach() in /home/myname/public_html/myshopsadmin/includes/functions/general.php on line 1292

 

Warning: Cannot modify header information - headers already sent by (output started at /home/myname/public_html/myshopsadmin/includes/functions/general.php:1292) in /home/myname/public_html/myshopsadmin/includes/functions/general.php on line 65

 

I suspect it has something to do with this in the admins general.php as follows:

 

function tep_reset_cache_block($cache_block) {
 global $cache_blocks;

 $pid = '*';
 if ($cache_block == 'xsell_products') {
  $pid = '';
if (isset($_GET['add_related_product_ID']) ) {
 $pid =  $_GET['add_related_product_ID'];
}
if ( !$pid ) $pid = '*';
 }
 for ($i=0, $n=sizeof($cache_blocks); $i<$n; $i++) {
if ($cache_blocks[$i]['code'] == $cache_block) {
  $glob_pattern = preg_replace('#-language.+$#', '-*', $cache_blocks[$i]['file']);
  foreach ( glob(DIR_FS_CACHE . $glob_pattern . '.cache' . $pid) as $cache_file ) {
	 @unlink($cache_file);
  }
  break;
}
 }
}

 

Specifically around here?

 

  $glob_pattern = preg_replace('#-language.+$#', '-*', $cache_blocks[$i]['file']); <--line 1291 in general.php
  foreach ( glob(DIR_FS_CACHE . $glob_pattern . '.cache' . $pid) as $cache_file ) {  <--line 1292 in general.php

 

with the preg_replace part. Just guessing. Any ideas?


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

Any ideas?

 

Yea...took some serious mining but @@ecartz a solution here


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

@@Gergely

Why isn't this code included into the instructions? This was the only way I could get mine to work without any errors.

Thanks A LOT

Share this post


Link to post
Share on other sites

I'm trying to adapt this add-on for use with 2.3.2. Below is the code from my includes/modules/xsell_products.php. The only problem is that only one cross-sell product is displayed, no matter how many are specified to show in admin. Any ideas?

<?php
/*
$Id: xsell_products.php, v1  2002/09/11
// adapted for Separate Pricing Per Customer v4 2005/02/24
osCommerce, Open Source E-Commerce Solutions
<http://www.oscommerce.com>
Copyright (c) 2002 osCommerce
Released under the GNU General Public License
*/
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_XSELL_PRODUCTS);
if ((USE_CACHE == 'true') && empty($SID)) {
// include currencies class and create an instance
require_once(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();
}
if (isset($HTTP_GET_VARS['products_id'])) {
 $xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, products_price, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, specials_new_products_price
from " . TABLE_PRODUCTS_XSELL . " xp left join " . TABLE_PRODUCTS . " p on xp.xsell_id = p.products_id
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
where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "'
and p.products_status = '1'
order by sort_order asc limit " . MAX_DISPLAY_XSELL);
$num_products_xsell = tep_db_num_rows($xsell_query);
if ($num_products_xsell > 0) {
 $counter = 0;
 $col = 0;
 $xsell_products_content = '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="ui-widget-content ui-corner-bottom">';
   while ($xsell = tep_db_fetch_array($xsell_query)) {
  $counter++;
  if ($col === 0) {
    $xsell_products_content .= '<tr>';
  }
  if (tep_not_null($xsell[$x]['specials_new_products_price'])) {
   $xsell_price =  '<s>' . $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</s><br />';
    $xsell_price .= '<span class="productSpecialPrice">' . $currencies->display_price($xsell['specials_new_products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</span>';
  } else {
   $xsell_price =  $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id']));
  }
   $xsell_products_content = '<td width="33%" align="center" valign="top"><br /><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_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=buy_now&product_to_buy_id=' . $xsell['products_id'], 'NONSSL')) .'</a></td>';
   $col ++;
   if (($col > 2) || ($counter == $num_products_xsell)) {
	 $xsell_products_content .= '</tr>';
	 $col = 0;
   }
 }
  $xsell_products_content .= '</table>';
?>
 <br /><br /><br />
 <div class="ui-widget infoBoxContainer" style="text-align: center">
   <div class="ui-widget-header ui-corner-top infoBoxHeading" style="text-align: left">
  <span><?php echo TEXT_XSELL_PRODUCTS; ?></span>
   </div>
   <?php echo $xsell_products_content; ?>
 </div>
<?php
  }
}
?>

Share this post


Link to post
Share on other sites

Hi! :)

 

I'm trying to get the x-sell products to display a certain way on the product info page, but I can't seem to figure out what I need to do.

Basically I want them displayed like in the "what's new" page (have a look here: http://dory.gr/2013h/index.php). Pink boxes symmetrically divided and with spacing between them.

What I am getting at the moment is this: http://dory.gr/2013h/product_info.php?cPath=26&products_id=30.

 

Any ideas as to what I need to change??? :wacko:

 

 

------------------

Never mind!!!! I got it. Switched the file with a file that was posted in a previous post and tweaked it a little.

Edited by Sardonic76

Share this post


Link to post
Share on other sites

@@Sardonic76

 

probably you need "equalheight" script. Look after in webcontents or ask a web designer.


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Hello,

I want my X-Sell to show ONLY active products on list in admin... Because i have really mess here... Could anyone tell me how to do it?

Sorry for my bad english, but i think that you understood ;)

 

Thx :)

Edited by brt32

Share this post


Link to post
Share on other sites

I have a problem in admin > Search Model Number

 

Typically, if there are 6 or 7 products with the prefix PCV_14 it returns only three.

 

RC2A much modified.

 

Any suggestions?

Share this post


Link to post
Share on other sites

@@dreaminggates@@dvharrison

 

See my posts here: http://forums.oscommerce.com/topic/395359-modding-up-a-new-2334-install-documented/ basically you need to ignore the references to the mobile files and delete some of the query fields from the latest version of the contribution.


Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Share this post


Link to post
Share on other sites

It works! Thanks Heather. My only gripe is that I have about 5 empty lines of cross-sell data that I cannot seem to get rid of. No delete button.

 

I can empty it via PHP MyAdmin level but how is one supposed to remove entries at user level?


Debbie Harrison

 

Share this post


Link to post
Share on other sites

And it doesn't look right. I think I'll revert back for now.

post-125872-0-23287200-1386794562_thumb.png

Edited by dvharrison

Debbie Harrison

 

Share this post


Link to post
Share on other sites

That is not caused by cross sell - they are product Id's in your database that dont have info against them.


Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Share this post


Link to post
Share on other sites

It's not just that though, the iamges weren't showing up either. I think I need to play. Thank goodness for backups :)


Debbie Harrison

 

Share this post


Link to post
Share on other sites

OK - you need to look at the changes as detailed in my post on installing on 2.3.3.4 regarding changing the images directory called up in the files - as it is incorrect in the latest add-on version.

 

I will send you a link to my development store so you can see how it looks when working.


Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Share this post


Link to post
Share on other sites

I think I've worked out the problem: The folder name was coming up as DIR_WS_CATALOG_IMAGES_THUMBS.I have changed this back to DIR_WS_CATLOG_IMAGES and made sure both width and height were set.

Edited by dvharrison

Debbie Harrison

 

Share this post


Link to post
Share on other sites

Did you read post #23 of http://forums.oscommerce.com/topic/395359-modding-up-a-new-2334-install-documented/page__st__20 as I suggested:

 

This version uses the correct 2.3 buttons etc but also assumes that you have several other contributions installed - If it does not work for you then carry out the following changes in admin/xsell.php and catalog/includes/modules/xsell_products.php
  • Remove all instances of p.image_display
  • Remove all instances of p.image_folder
  • Amend all instances of DIR_WS_IMAGES_THUMBS to read DIR_WS_IMAGES

 

There are other necessary changes in that post as well.


Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Share this post


Link to post
Share on other sites

No Problems - I will eventually update the mod when I get my new 2.3.3.4 sites up and running.


Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Share this post


Link to post
Share on other sites

Hello -

 

I installed XSell successfully a week ago. Since then, I've added new products to my store, but the XSell section has not updated. It still only shows 40 products (out of 80).

 

How can I fix this?

 

Thank you!

Share this post


Link to post
Share on other sites

Hi

 

module works fine; we use 2.3.1 osc

there is only one minor flaw or bug

 

IF we Xsell a product that WAS a special

but now as special inactive , status = 0

then the special price is still seen on the xsell box somehow.

 

 I tried many things but somehow did not get it to make it then simply show the product price and not the specials price.

Share this post


Link to post
Share on other sites

Hi

 

Is this add-on ok to use on OScommerce 2.3.4?

 

My hosting provider have recently upgraded as they no longer support PHP 5.4.  So I have to be really careful.

 

I welcome any advice. :lol:


Debbie Harrison

 

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

×