Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Cross Sell (X-Sell) Admin


dreamscape

Recommended Posts

  • 2 weeks later...

Hi Everybody,

 

Thanks for a great contribution, I installed it and it is working like a charm.

 

I read through the whole forum to see if there is an answer to this question but only found Kunal that asked the same:

 

2. Currently it only displays 6 items, I need it to display as many as are assigned to the product.

 

At the moment only 6 items are displayed - my customers are in the equipment business and they want to sell the machine with the spare parts/accessories listed underneath. In most cases the accessories/spare parts add up to more than 6 items.

 

We would not add tumbnails to the parts/accessories, merely a list with a short description which then could be added to the total order.

 

Some help will be highly appreciated.

 

Marinda Stuiver

Link to comment
Share on other sites

Hi,

 

I followed all the steps and installed this Contributions. Now - when I try to log into the admin area - I get the following Error:

 

 

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

 

Parse error: syntax error, unexpected T_STRING in /home/gourmet/public_html/shop/admin/includes/functions/general.php on line 23

 

And when trying to open up the website - it gives the following Errors:

 

Warning: main(includes/modules/FILENAME_UPCOMING_PRODUCTS): failed to open stream: No such file or directory in /home/gourmet/public_html/shop/index.php on line 316

 

Warning: main(includes/modules/FILENAME_UPCOMING_PRODUCTS): failed to open stream: No such file or directory in /home/gourmet/public_html/shop/index.php on line 316

 

Warning: main(): Failed opening 'includes/modules/FILENAME_UPCOMING_PRODUCTS' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gourmet/public_html/shop/index.php on line 316

 

Warning: main(includes/modules/FILENAME_NEW_PRODUCTS): failed to open stream: No such file or directory in /home/gourmet/public_html/shop/index.php on line 313

 

Warning: main(includes/modules/FILENAME_NEW_PRODUCTS): failed to open stream: No such file or directory in /home/gourmet/public_html/shop/index.php on line 313

 

Warning: main(): Failed opening 'includes/modules/FILENAME_NEW_PRODUCTS' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gourmet/public_html/shop/index.php on line 313

 

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

 

 

Would someone know why that is? :rolleyes:

 

Thank you for your help, :thumbsup:

 

 

Jan

Link to comment
Share on other sites

Hi,

 

 

I now got the ADMIN working but the website still gives the same Error messages. :blink:

 

 

for example:

 

 

 

Warning: main(includes/modules/FILENAME_UPCOMING_PRODUCTS): failed to open stream: No such file or directory in /home/gourmet/public_html/shop/index.php on line 316

 

I have looked up all these lines referenced in the Error message and found the following code:

 

 

 

<td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td>

 

<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

 

 

<?php include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS); ?>

 

 

<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

 

 

 

 

 

Would anyone please know what I need to do to fix this? I'm not sure if I setup the path to the Cache correctly - would that do it? Also - is there an older version of this Contribution that I could install that would work better? Or - I have installed 2 other Contributions prior to this one (CALENDAR and extra shipping options) - would that be the problem? Should I delete everything and then install this Contribution on a clean slate?

 

 

PLEASE HELP....

 

 

 

Thank you for your help, :thumbsup:

 

 

Jan

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

Guys finaly got almost everything working.

One last problem.

If a customer adds a product from the product list to the cart and does not select any of the cross sale products.

The cross sell items apear under the shopping_cart.php

But if you select an item and clcik update it does not add the product to the cart.

 

Can you help! is there a fix for this?

You can have a look over here - Click Here

 

Hope you can help!

Kunal :thumbsup:

Link to comment
Share on other sites

Guys finaly got almost everything working.

One last problem.

If a customer adds a product from the product list to the cart and does not select any of the cross sale products.

The cross sell items apear under the shopping_cart.php

But if you select an item and clcik update it does not add the product to the cart.

 

Can you help! is there a fix for this?

You can have a look over here - Click Here

 

Hope you can help!

Kunal :thumbsup:

One more things I have just noticed.

Some of the products listed dont have the product names on them.

 

can you help?

Kunal

Link to comment
Share on other sites

  • 1 month later...

Step 14 is in French for instal of xsell 2.3

Anybody got an English translation?

 

 

STEP 14:

Add to /catalog/admin/includes/functions/general.php

 

//Cache

function rdel($path, $deldir = true) {

// $path est le chemin relatif au fichier php

// $deldir (paramètre optionel, par défaut à vrai) permet de dire si vous souhaitez supprimer le répertoire (vrai) ou le vider uniquement (faux)

 

// on vérifie d'abord que le nom du repertoire contient "/" à la fin, sinon on le lui rajoute

if ($path[strlen($path)-1] != "/")

$path .= "/";

 

if (is_dir($path)) {

$d = opendir($path);

 

while ($f = readdir($d)) {

if ($f != "." && $f != "..") {

$rf = $path . $f; // chemin relatif au fichier php

 

if (is_dir($rf)) // si c'est un répertoire on appel récursivement la fonction

rdel($rf);

else // sinon on efface le fichier

unlink($rf);

}

}

closedir($d);

 

if ($deldir) // si $deldir est vrai on efface le répertoire

rmdir($path);

}

else {

unlink($path);

}

}

 

//Fin cache

Link to comment
Share on other sites

This module is great but I manage to get it to work only for 1 product :blush: I cannot find any logic in this!!!!

 

I've update it to 2.3 (with the cache option). I've created a directory "catalog/xsell" and applied 777 chmod. A sub-diretory is successfully created for my working product with the right ID. Then a file 7-0.php is created. (Ex : catalog/xsell/118/7-0.php) Everything seems to work fine but just for 1 product!!!!!

 

I wonder if I have to turn on the cache option in admin/configuration/cache? I don't even dare to try.......

 

Thanks for any response :thumbsup:

sub-total (tax free), Bookmark, Browse by Categories 2.5, Category box enhancement, Contact us choice 1.0.1, Featured products 1.5.5.1, MultiGeoZone MultiTable Shipping 1.101, Os Active Desktop 2.3, Paymenttypes 1.2, Phpmyvisites 2.1, Session counter, Skype Contact 1.0, Stats products per month 1, Store Pick Up Version 1.4, Updated spiders.txt, Who's Online Enhancement 2.00, BackButtons, Google Analytics, stats_sales_csv_1.2, google_position_1.3, Customers List Improved 1.4, boxe defilante

Link to comment
Share on other sites

  • 2 weeks later...
Hi! Could anyone please tell me how I can comment out the BUY NOW button?

 

This contribution is great, by the way! I am very happy with it!

 

Thank you! :)

 

After searching this thread for the same information myself I figured I'd post the answer since I seem to have figured it out :)

 

I didn't "comment out" the Buy Now button, but rather I deleted it as I wasn't sure how to comment it out as the typical PHP comment tags didn't seem to be working. But anyway - you can find it in

 

includes/modules/xsell_products.php - look for the following line of code:

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

 

All I did was delete this part of the above code:

<a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $xsell['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $xsell['products_name'] . TEXT_NOW) .'</a>

Make sure you leave the final ' otherwise you won't be properly closing out the '<br> just in front of that bit of code ;)

 

I did learn though - that in order for me to see the change I had to go through FTP into the cache directory I had created and delete everything that was in that folder :huh: Is there any other way to clear the cache directory?

~Tracy
 

Link to comment
Share on other sites

I'm having fun with trying to get this working with Infobox Customize. The Infobox Customize contribution allows you to set an individual look and feel to each of your infoboxes. It does this by creating code for each one individually in includes/classes/boxes.php and then you setup classes in your stylesheet for each one.

 

I am attempting to allow includes/modules/xsell_products.php to also be governed by the stylesheet in the same way as the other infoboxes. So I created the individual code for the XsellBox in includes/classes/boxes.php and set the "new infoBox and new infoBoxHeading to be new XsellBox and new XsellBoxHeading.

 

Now - the box is showing up correctly according to the stylesheet settings - however, the content has disappeared :huh: I have no idea why the content is not showing in the box, and I'm assuming it might have something to do with how the includes/classes/boxes.php code and the includes/modules/xsell_products.php code are working together. I'm not well enough versed in PHP yet to be able to just look and see - so I'm hoping that someone here might be able to see where the problem is.

 

The xsell_products.php code:

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_XSELL_PRODUCTS);

// BOF Separate Pricing Per Customer
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
} else {
 $customer_group_id = $sppc_customer_group_id;
}

if ($HTTP_GET_VARS['products_id']) {

//Cache
$dircache = DIR_FS_CACHE_XSELL . $HTTP_GET_VARS['products_id'] . '/';
$filename = $dircache  . $languages_id . '-' . $customer_group_id . '.php';
$cache = '<?php 
 $info_box_contents = array();
 $info_box_contents[] = array(\'align\' => \'left\', \'text\' => TEXT_XSELL_PRODUCTS);
 new XsellBoxHeading($info_box_contents);
 $info_box_contents = array();';
if (file_exists($filename))
{require $filename;}
else
{
//Fin cache

if ($customer_group_id != '0') {
$xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_status = '1' and pg.customers_group_id = '".$customer_group_id."' order by sort_order asc limit " . MAX_DISPLAY_ALSO_PURCHASED);
} else {
$xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, products_price from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_status = '1' order by sort_order asc limit " . MAX_DISPLAY_ALSO_PURCHASED);
}
// EOF Separate Pricing Per Customer

$num_products_xsell = tep_db_num_rows($xsell_query);
if ($num_products_xsell > 0) {
?>
<!-- xsell_products //-->
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'left', 'text' => TEXT_XSELL_PRODUCTS);
 new XsellBoxHeading($info_box_contents);

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 while ($xsell = tep_db_fetch_array($xsell_query)) {
   $xsell['specials_new_products_price'] = tep_get_products_special_price($xsell['products_id']);

if ($xsell['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']));
  }
   //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>';
   //Fin cache
   $info_box_contents[$row][$col] = array('align' => 'center',
										  'params' => 'class="XsellBoxContents" width="33%" valign="top"',
										  'text' => $text); //Modifié Cache
   //Cache
   $cache .= '$info_box_contents[' .$row . '][' . $col . '] = array(\'align\' => \'center\',
										  \'params\' => \'class="XsellBoxContents" width="33%" valign="top"\',
										  \'text\' => \'' . str_replace("'", "\'", $text) .'\');';
   //Fin cache	   
   $col ++;
   if ($col > 2) {
	 $col = 0;
	 $row ++;
   }
 }
new XsellBox($info_box_contents);
//Cache
 $cache .= 'new XsellBox($info_box_contents); ?>';
 if(!is_dir($dircache)) { mkdir($dircache,0777); }
 $fp = fopen($filename , 'w');
 $fout = fwrite($fp , $cache);
 fclose($fp);
}
//Fin Cache

 

The code in includes/classes/boxes.php that is now also affecting xsell_products.php

//New XsellBox Class
 class XsellBox extends tableBox {
function XsellBox($contents) {
  $info_box_contents = array();
  $info_box_contents[] = array('text' => $this->XsellBoxContents($contents));
  $this->table_width = '80%';
  $this->table_cellpadding = '1';
  $this->table_parameters = 'class="XsellBox"';
  $this->tableBox($info_box_contents, true);
}

function XsellBoxContents($contents) {
  $this->table_cellpadding = '3';
  $this->table_parameters = 'class="XsellBoxContents"';
  $info_box_contents = array();
  $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
  for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
	$info_box_contents[] = array(array('align' => $contents[$i]['align'],
									   'params' => 'class="XsellBoxContents"',
									   'text' => $contents[$i]['text']));
  }
  $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
  return $this->tableBox($info_box_contents);
}
 }

 class XsellBoxHeading extends tableBox {
function XsellBoxHeading($contents, $left_corner = false, $right_corner = false, $right_arrow = false) {
  $this->table_width = '80%';
  $this->table_cellpadding = '0';
  $this->table_parameters = 'class="XsellBoxHeading"';
/* commented out the corner images
  if ($left_corner == true) {
	$left_corner = tep_image(DIR_WS_IMAGES . 'XsellBox/corner_left.gif');
  } else {
	$left_corner = tep_image(DIR_WS_IMAGES . 'Xsell/corner_right_left.gif');
  }
  if ($right_arrow == true) {
	$right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'TXsellBox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';
  } else {
	$right_arrow = '';
  }
  if ($right_corner == true) {
	$right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'Xsell/corner_right.gif');
  } else {
	$right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');
  }
*/
  $info_box_contents = array();
  $info_box_contents[] = array(array('params' => 'height="14" class="XsellBoxHeading"',
									 'text' => $left_corner),
							   array('params' => 'width="100%" height="14" class="XsellBoxHeading"',
									 'text' => $contents[0]['text']),
							   array('params' => 'height="14" class="XsellBoxHeading" nowrap',
									 'text' => $right_corner));

  $this->tableBox($info_box_contents, true);
}
 }

 

I'm guessing there is something conflicting in the contents section as the header shows up just fine. Anybody see a red flag?

~Tracy
 

Link to comment
Share on other sites

I'm having fun with trying to get this working with Infobox Customize. The Infobox Customize contribution allows you to set an individual look and feel to each of your infoboxes. It does this by creating code for each one individually in includes/classes/boxes.php and then you setup classes in your stylesheet for each one.

 

I am attempting to allow includes/modules/xsell_products.php to also be governed by the stylesheet in the same way as the other infoboxes. So I created the individual code for the XsellBox in includes/classes/boxes.php and set the "new infoBox and new infoBoxHeading to be new XsellBox and new XsellBoxHeading.

 

Now - the box is showing up correctly according to the stylesheet settings - however, the content has disappeared :huh: I have no idea why the content is not showing in the box, and I'm assuming it might have something to do with how the includes/classes/boxes.php code and the includes/modules/xsell_products.php code are working together. I'm not well enough versed in PHP yet to be able to just look and see - so I'm hoping that someone here might be able to see where the problem is.

 

The xsell_products.php code:

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_XSELL_PRODUCTS);

// BOF Separate Pricing Per Customer
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
} else {
 $customer_group_id = $sppc_customer_group_id;
}

if ($HTTP_GET_VARS['products_id']) {

//Cache
$dircache = DIR_FS_CACHE_XSELL . $HTTP_GET_VARS['products_id'] . '/';
$filename = $dircache  . $languages_id . '-' . $customer_group_id . '.php';
$cache = '<?php 
 $info_box_contents = array();
 $info_box_contents[] = array(\'align\' => \'left\', \'text\' => TEXT_XSELL_PRODUCTS);
 new XsellBoxHeading($info_box_contents);
 $info_box_contents = array();';
if (file_exists($filename))
{require $filename;}
else
{
//Fin cache

if ($customer_group_id != '0') {
$xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_status = '1' and pg.customers_group_id = '".$customer_group_id."' order by sort_order asc limit " . MAX_DISPLAY_ALSO_PURCHASED);
} else {
$xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, products_price from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_status = '1' order by sort_order asc limit " . MAX_DISPLAY_ALSO_PURCHASED);
}
// EOF Separate Pricing Per Customer

$num_products_xsell = tep_db_num_rows($xsell_query);
if ($num_products_xsell > 0) {
?>
<!-- xsell_products //-->
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'left', 'text' => TEXT_XSELL_PRODUCTS);
 new XsellBoxHeading($info_box_contents);

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 while ($xsell = tep_db_fetch_array($xsell_query)) {
   $xsell['specials_new_products_price'] = tep_get_products_special_price($xsell['products_id']);

if ($xsell['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']));
  }
   //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>';
   //Fin cache
   $info_box_contents[$row][$col] = array('align' => 'center',
										  'params' => 'class="XsellBoxContents" width="33%" valign="top"',
										  'text' => $text); //Modifié Cache
   //Cache
   $cache .= '$info_box_contents[' .$row . '][' . $col . '] = array(\'align\' => \'center\',
										  \'params\' => \'class="XsellBoxContents" width="33%" valign="top"\',
										  \'text\' => \'' . str_replace("'", "\'", $text) .'\');';
   //Fin cache	   
   $col ++;
   if ($col > 2) {
	 $col = 0;
	 $row ++;
   }
 }
new XsellBox($info_box_contents);
//Cache
 $cache .= 'new XsellBox($info_box_contents); ?>';
 if(!is_dir($dircache)) { mkdir($dircache,0777); }
 $fp = fopen($filename , 'w');
 $fout = fwrite($fp , $cache);
 fclose($fp);
}
//Fin Cache

 

The code in includes/classes/boxes.php that is now also affecting xsell_products.php

//New XsellBox Class
 class XsellBox extends tableBox {
function XsellBox($contents) {
  $info_box_contents = array();
  $info_box_contents[] = array('text' => $this->XsellBoxContents($contents));
  $this->table_width = '80%';
  $this->table_cellpadding = '1';
  $this->table_parameters = 'class="XsellBox"';
  $this->tableBox($info_box_contents, true);
}

function XsellBoxContents($contents) {
  $this->table_cellpadding = '3';
  $this->table_parameters = 'class="XsellBoxContents"';
  $info_box_contents = array();
  $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
  for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
	$info_box_contents[] = array(array('align' => $contents[$i]['align'],
									   'params' => 'class="XsellBoxContents"',
									   'text' => $contents[$i]['text']));
  }
  $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
  return $this->tableBox($info_box_contents);
}
 }

 class XsellBoxHeading extends tableBox {
function XsellBoxHeading($contents, $left_corner = false, $right_corner = false, $right_arrow = false) {
  $this->table_width = '80%';
  $this->table_cellpadding = '0';
  $this->table_parameters = 'class="XsellBoxHeading"';
/* commented out the corner images
  if ($left_corner == true) {
	$left_corner = tep_image(DIR_WS_IMAGES . 'XsellBox/corner_left.gif');
  } else {
	$left_corner = tep_image(DIR_WS_IMAGES . 'Xsell/corner_right_left.gif');
  }
  if ($right_arrow == true) {
	$right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'TXsellBox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';
  } else {
	$right_arrow = '';
  }
  if ($right_corner == true) {
	$right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'Xsell/corner_right.gif');
  } else {
	$right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');
  }
*/
  $info_box_contents = array();
  $info_box_contents[] = array(array('params' => 'height="14" class="XsellBoxHeading"',
									 'text' => $left_corner),
							   array('params' => 'width="100%" height="14" class="XsellBoxHeading"',
									 'text' => $contents[0]['text']),
							   array('params' => 'height="14" class="XsellBoxHeading" nowrap',
									 'text' => $right_corner));

  $this->tableBox($info_box_contents, true);
}
 }

 

I'm guessing there is something conflicting in the contents section as the header shows up just fine. Anybody see a red flag?

~Tracy
 

Link to comment
Share on other sites

I'm having fun with trying to get this working with Infobox Customize. The Infobox Customize contribution allows you to set an individual look and feel to each of your infoboxes. It does this by creating code for each one individually in includes/classes/boxes.php and then you setup classes in your stylesheet for each one.

 

I am attempting to allow includes/modules/xsell_products.php to also be governed by the stylesheet in the same way as the other infoboxes. So I created the individual code for the XsellBox in includes/classes/boxes.php and set the "new infoBox and new infoBoxHeading to be new XsellBox and new XsellBoxHeading.

 

Now - the box is showing up correctly according to the stylesheet settings - however, the content has disappeared :huh: I have no idea why the content is not showing in the box, and I'm assuming it might have something to do with how the includes/classes/boxes.php code and the includes/modules/xsell_products.php code are working together. I'm not well enough versed in PHP yet to be able to just look and see - so I'm hoping that someone here might be able to see where the problem is.

 

The xsell_products.php code:

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_XSELL_PRODUCTS);

// BOF Separate Pricing Per Customer
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
} else {
 $customer_group_id = $sppc_customer_group_id;
}

if ($HTTP_GET_VARS['products_id']) {

//Cache
$dircache = DIR_FS_CACHE_XSELL . $HTTP_GET_VARS['products_id'] . '/';
$filename = $dircache  . $languages_id . '-' . $customer_group_id . '.php';
$cache = '<?php 
 $info_box_contents = array();
 $info_box_contents[] = array(\'align\' => \'left\', \'text\' => TEXT_XSELL_PRODUCTS);
 new XsellBoxHeading($info_box_contents);
 $info_box_contents = array();';
if (file_exists($filename))
{require $filename;}
else
{
//Fin cache

if ($customer_group_id != '0') {
$xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_status = '1' and pg.customers_group_id = '".$customer_group_id."' order by sort_order asc limit " . MAX_DISPLAY_ALSO_PURCHASED);
} else {
$xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, products_price from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_status = '1' order by sort_order asc limit " . MAX_DISPLAY_ALSO_PURCHASED);
}
// EOF Separate Pricing Per Customer

$num_products_xsell = tep_db_num_rows($xsell_query);
if ($num_products_xsell > 0) {
?>
<!-- xsell_products //-->
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'left', 'text' => TEXT_XSELL_PRODUCTS);
 new XsellBoxHeading($info_box_contents);

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 while ($xsell = tep_db_fetch_array($xsell_query)) {
   $xsell['specials_new_products_price'] = tep_get_products_special_price($xsell['products_id']);

if ($xsell['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']));
  }
   //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>';
   //Fin cache
   $info_box_contents[$row][$col] = array('align' => 'center',
										  'params' => 'class="XsellBoxContents" width="33%" valign="top"',
										  'text' => $text); //Modifié Cache
   //Cache
   $cache .= '$info_box_contents[' .$row . '][' . $col . '] = array(\'align\' => \'center\',
										  \'params\' => \'class="XsellBoxContents" width="33%" valign="top"\',
										  \'text\' => \'' . str_replace("'", "\'", $text) .'\');';
   //Fin cache	   
   $col ++;
   if ($col > 2) {
	 $col = 0;
	 $row ++;
   }
 }
new XsellBox($info_box_contents);
//Cache
 $cache .= 'new XsellBox($info_box_contents); ?>';
 if(!is_dir($dircache)) { mkdir($dircache,0777); }
 $fp = fopen($filename , 'w');
 $fout = fwrite($fp , $cache);
 fclose($fp);
}
//Fin Cache

 

The code in includes/classes/boxes.php that is now also affecting xsell_products.php

//New XsellBox Class
 class XsellBox extends tableBox {
function XsellBox($contents) {
  $info_box_contents = array();
  $info_box_contents[] = array('text' => $this->XsellBoxContents($contents));
  $this->table_width = '80%';
  $this->table_cellpadding = '1';
  $this->table_parameters = 'class="XsellBox"';
  $this->tableBox($info_box_contents, true);
}

function XsellBoxContents($contents) {
  $this->table_cellpadding = '3';
  $this->table_parameters = 'class="XsellBoxContents"';
  $info_box_contents = array();
  $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
  for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
	$info_box_contents[] = array(array('align' => $contents[$i]['align'],
									   'params' => 'class="XsellBoxContents"',
									   'text' => $contents[$i]['text']));
  }
  $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
  return $this->tableBox($info_box_contents);
}
 }

 class XsellBoxHeading extends tableBox {
function XsellBoxHeading($contents, $left_corner = false, $right_corner = false, $right_arrow = false) {
  $this->table_width = '80%';
  $this->table_cellpadding = '0';
  $this->table_parameters = 'class="XsellBoxHeading"';
/* commented out the corner images
  if ($left_corner == true) {
	$left_corner = tep_image(DIR_WS_IMAGES . 'XsellBox/corner_left.gif');
  } else {
	$left_corner = tep_image(DIR_WS_IMAGES . 'Xsell/corner_right_left.gif');
  }
  if ($right_arrow == true) {
	$right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'TXsellBox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';
  } else {
	$right_arrow = '';
  }
  if ($right_corner == true) {
	$right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'Xsell/corner_right.gif');
  } else {
	$right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');
  }
*/
  $info_box_contents = array();
  $info_box_contents[] = array(array('params' => 'height="14" class="XsellBoxHeading"',
									 'text' => $left_corner),
							   array('params' => 'width="100%" height="14" class="XsellBoxHeading"',
									 'text' => $contents[0]['text']),
							   array('params' => 'height="14" class="XsellBoxHeading" nowrap',
									 'text' => $right_corner));

  $this->tableBox($info_box_contents, true);
}
 }

 

I'm guessing there is something conflicting in the contents section as the header shows up just fine. Anybody see a red flag?

~Tracy
 

Link to comment
Share on other sites

I'm having fun with trying to get this working with Infobox Customize. The Infobox Customize contribution allows you to set an individual look and feel to each of your infoboxes. It does this by creating code for each one individually in includes/classes/boxes.php and then you setup classes in your stylesheet for each one.

 

I am attempting to allow includes/modules/xsell_products.php to also be governed by the stylesheet in the same way as the other infoboxes. So I created the individual code for the XsellBox in includes/classes/boxes.php and set the "new infoBox and new infoBoxHeading to be new XsellBox and new XsellBoxHeading.

 

Now - the box is showing up correctly according to the stylesheet settings - however, the content has disappeared :huh: I have no idea why the content is not showing in the box, and I'm assuming it might have something to do with how the includes/classes/boxes.php code and the includes/modules/xsell_products.php code are working together. I'm not well enough versed in PHP yet to be able to just look and see - so I'm hoping that someone here might be able to see where the problem is.

 

I have managed to get it working (see code below for anyone else trying to do this) but I have one more question ;)

 

I only have one upsell product at a time in the box. For some reason - the image for the product is being aligned to the right rather than being directly above the product name. Any ideas on what's causing that?

 

 

Here's the code for how I got Infobox Customize controlling the xsell_products.php

includes/modules/xsell_products.php

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_XSELL_PRODUCTS);

// BOF Separate Pricing Per Customer
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
} else {
 $customer_group_id = $sppc_customer_group_id;
}

if ($HTTP_GET_VARS['products_id']) {

//Cache
$dircache = DIR_FS_CACHE_XSELL . $HTTP_GET_VARS['products_id'] . '/';
$filename = $dircache  . $languages_id . '-' . $customer_group_id . '.php';
$cache = '<?php 
 $info_box_contents = array();
 $info_box_contents[] = array(\'align\' => \'left\', \'text\' => TEXT_XSELL_PRODUCTS);
 new XsellBoxHeading($info_box_contents);
 $info_box_contents = array();';
if (file_exists($filename))
{require $filename;}
else
{
//Fin cache

if ($customer_group_id != '0') {
$xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_status = '1' and pg.customers_group_id = '".$customer_group_id."' order by sort_order asc limit " . MAX_DISPLAY_ALSO_PURCHASED);
} else {
$xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, products_price from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_status = '1' order by sort_order asc limit " . MAX_DISPLAY_ALSO_PURCHASED);
}
// EOF Separate Pricing Per Customer

$num_products_xsell = tep_db_num_rows($xsell_query);
if ($num_products_xsell > 0) {
?>
<!-- xsell_products //-->
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'left', 'text' => TEXT_XSELL_PRODUCTS);
 new XsellBoxHeading($info_box_contents);

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 while ($xsell = tep_db_fetch_array($xsell_query)) {
   $xsell['specials_new_products_price'] = tep_get_products_special_price($xsell['products_id']);

if ($xsell['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']));
  }
   //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>';
   //Fin cache
   $info_box_contents[$row][$col] = array('align' => 'center',
										  'params' => 'class="XsellBoxContents" width="33%" valign="top"',
										  'text' => $text); //Modifié Cache
   //Cache
   $cache .= '$info_box_contents[' .$row . '][' . $col . '] = array(\'align\' => \'center\',
										  \'params\' => \'class="XsellBoxContents" width="33%" valign="top"\',
										  \'text\' => \'' . str_replace("'", "\'", $text) .'\');';
   //Fin cache	   
   $col ++;
   if ($col > 2) {
	 $col = 0;
	 $row ++;
   }
 }
new XsellBox($info_box_contents);
//Cache
 $cache .= 'new XsellBox($info_box_contents); ?>';
 if(!is_dir($dircache)) { mkdir($dircache,0777); }
 $fp = fopen($filename , 'w');
 $fout = fwrite($fp , $cache);
 fclose($fp);
}
//Fin Cache

 

includes/classes/boxes.php (if you have Infobox Customize installed) add:

//New XsellBox Class
 class XsellBox extends tableBox {
function XsellBox($contents) {
  $this->table_parameters = 'class="XsellBox"';
  $this->tableBox($contents, true);
 }
}

function BestSellersBoxContents($contents) {
  $this->table_cellpadding = '3';
  $this->table_parameters = 'class="BestSellersBoxContents"';
 }

class XsellBoxHeading extends tableBox {
function XsellBoxHeading($contents, $left_corner = false, $right_corner = false, $right_arrow = false) {
  $this->table_cellpadding = '0';
  $this->table_width = '100%';
/*commented out the images
  if ($left_corner == true) {
	$left_corner = tep_image(DIR_WS_IMAGES . 'XsellBox/corner_left.gif');
  } else {
	$left_corner = tep_image(DIR_WS_IMAGES . 'XsellBox/corner_right_left.gif');
  }
  if ($right_arrow == true) {
	$right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'XsellBox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';
  } else {
	$right_arrow = '';
  }
  if ($right_corner == true) {
	$right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'XsellBox/corner_right.gif');
  } else {
	$right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');
  }
*/
  $info_box_contents = array();
  $info_box_contents[] = array(array('params' => 'height="14" class="XsellBoxHeading"',
									 'text' => ''),
							   array('params' => 'width="100%" height="14" class="XsellBoxHeading"',
									 'text' => $contents[0]['text']),
							   array('params' => 'height="14" class="XsellBoxHeading" nowrap',
									 'text' => ''));

  $this->tableBox($info_box_contents, true);
}
 }

~Tracy
 

Link to comment
Share on other sites

Warning: main(includes/modules/FILENAME_XSELL_PRODUCTS) [function.main]: failed to open stream: No such file or directory in /home/cdlpress/public_html/catalog/product_info.php on line 238

 

Warning: main(includes/modules/FILENAME_XSELL_PRODUCTS) [function.main]: failed to open stream: No such file or directory in /home/cdlpress/public_html/catalog/product_info.php on line 238

 

Warning: main() [function.include]: Failed opening 'includes/modules/FILENAME_XSELL_PRODUCTS' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/cdlpress/public_html/catalog/product_info.php on line 238

 

 

 

It was working fine this morning i dontknow what i did!!! ON line 238 it's this

 

include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS);

 

 

 

whats missing???? my product_info is there!

Link to comment
Share on other sites

Hello!

 

Installed Xsell V2.3

 

Everything seems ok except when you goto the cart, select an item that has a xsell items I get the following errors. Can Anyone assist me?

 

 

Warning: mkdir(../cache/30/): No such file or directory in /catalog/includes/modules/xsell_products.php on line 86

 

Warning: fopen(../cache/30/1-0.php): failed to open stream: No such file or directory in /catalog/includes/modules/xsell_products.php on line 87

 

Warning: fwrite(): supplied argument is not a valid stream resource in /catalog/includes/modules/xsell_products.php on line 88

 

Warning: fclose(): supplied argument is not a valid stream resource in /catalog/includes/modules/xsell_products.php on line 89

 

Thanks

Pete

Link to comment
Share on other sites

  • 3 weeks later...

Hi, I just installed v2.3. Everything is fine, except that the contentBoxHeading where the "We recommend this:" should be, doesn't show up... I found a header fix for one of the later versions and tried that but didn't work... I tweaked it a bit and added this:

 

if ($count > 0) {

// start of add

echo "<div class=screenshotsHeader><div class=screenshotsHeaderText>";

echo TEXT_XSELL_PRODUCTS;

echo "</div> </div><div class=screenshotsBlock>";

// end of add

 

new contentBox($info_box_contents);

 

// added to close the box

echo "</div>";

// end of add

}

 

The header showed up but the box was empty! The products didn't show! Can anyone help?

 

I got the header fix here by kayakbabe:

http://www.oscommerce.com/community/contributions,1415

Link to comment
Share on other sites

Hi,

 

I've installed the contrib and everything works fine.

 

The main issue is that with over 3000 products it is not even worth beginning to use this as the amount of searching and guess work you have to do to find the page with the product on just takes up too much time.

 

So, I ask if anyone has an answer to these two questions:

 

1, Is there a bulk upload for this where you can edit an excel file of your products and simply upload - in the same way as easypopulate i suppose?

 

2, If the answer is NO to question 1 can anyone tell me what sql code is written to the database when you cross reference a product - from this we could simple write a HUGE sql command and dump it into the database

 

ie: insert into products_xsell where 2310 etc etc...

 

If anyone could point me out in the right direction it would be appreciated.

 

Many Thanks

D4

Link to comment
Share on other sites

Does anyone know how I can sort the products within Cress - Sell by product model?

 

Its hard to find what you would like to cross - sell with when there are over 3,000 items.

 

Thanks!

Pete

 

Well - I haven't tried this - but being I am just finishing installing Product Sort for the whole store I would say try changing this query in admin/xsell.php

$products_query_raw = 'select p.products_id, p.products_model, 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.'" order by pd.products_name asc';

 

At the very end where it says order by pd.products_name asc I would change it to

order by p.products_model asc

 

It's easy enough to at least give it a shot and see if it does the trick ;)

~Tracy
 

Link to comment
Share on other sites

Well - I haven't tried this - but being I am just finishing installing Product Sort for the whole store I would say try changing this query in admin/xsell.php

$products_query_raw = 'select p.products_id, p.products_model, 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.'" order by pd.products_name asc';

 

At the very end where it says order by pd.products_name asc I would change it to

order by p.products_model asc

 

It's easy enough to at least give it a shot and see if it does the trick ;)

 

That worked.....THANK YOU!!

Link to comment
Share on other sites

Hi,

 

i have install the version "xsell 2.2"

 

i have no error messages, i can select the cross sell products in admin i see the entry in the database,

but i see no cross sell products in the product_info...

what can i do to see it ?

thanks

 

best greeting

 

Are you using any other contributions that affect the product_listing.php file? For example, I have Master Products installed, so I had to edit different files for that contribution to be able to see the cross sell products box ;)

~Tracy
 

Link to comment
Share on other sites

Hi, thank you,

 

now it is ok, i see the cross-sell products !!! :D

 

but

 

if i buy a cross-sell product I am in the shopping cart... if i klick now on the back button i do not come back to the product i seen last...

 

I am on the side from the cross-sell article i buy...

 

 

what can i do to come back to the Produkt that i see last ???

 

 

like this:

 

i look Product A, there is the cross-sell Product B, i buy the cross-sell Product B, i am in shopping cart, now i want to go back to Product A...

 

how can that be done?

 

 

sorry for my bad english, i hope you understand and can help at this Problem...

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