Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Cross Sell (X-Sell) Admin


dreamscape

Recommended Posts

Hi,

 

I have turned off caching and I have deleted all cached files in the correspondent directories. I have also tried replacing my variable with yours, and I have also tried enterning an absolute number of total products to be displayed: No changes at all...

 

Maybe I will completely re-install the contrib. Or do you recommend another one?

 

Hi again, problem solved, but I don't know why: The only thing I have done is edit the cross sell articles assignment again, and then it worked...

 

thx for your help...

Link to comment
Share on other sites

Hi Kyle,

 

I put my code at the end of the page like this:

		</td>
  </tr>
</table></form><?php 
 include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); 
?>
</td>

 

You hadn't mentioned where you had tried putting it in your code previously so I hope this isn't one of the places you tried already. Good luck.

Link to comment
Share on other sites

  • 2 weeks later...

When I go into the admin of xsell and try to update a product I receive the following error:

 

Fatal error: Call to undefined function: rdel() in C:\Domains\domain.com\wwwroot\admin\xsell.php on line 42

 

I checked out both filenames.php within the admin/includes directory and the function is defined define('FILENAME_XSELL_PRODUCTS', 'xsell.php');

 

 

Any idea what could be causing the problem?

Link to comment
Share on other sites

When I go into the admin of xsell and try to update a product I receive the following error:

 

Fatal error: Call to undefined function: rdel() in C:\Domains\domain.com\wwwroot\admin\xsell.php on line 42

 

I checked out both filenames.php within the admin/includes directory and the function is defined define('FILENAME_XSELL_PRODUCTS', 'xsell.php');

Any idea what could be causing the problem?

Hi rick,

 

This forum is for Cross Sell (X-Sell) Admin Cont# 1005. I am thinking that your are looking for the forum for X-Sell v2-MS2 - Cross Sell for MS2 Cont# 1415 (This contribution uses admin/xsell_products.php) Yes, it does get really confusing with so many similar mods (and then mods of mods). I did not see any specific forum for your mod, I did find many single topic posts for that mod. (too bad those couldn't be 'moved').

 

By the way, define('FILENAME_XSELL_PRODUCTS', 'xsell.php'); defines a filename not a function.

 

From your problem description it sounds like you forgot step 14 of the installation instructions:

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

################################################################################
#####

 

Give this a try.

Link to comment
Share on other sites

  • 1 month later...
Unistalling what didn't help.

 

My last post was quite simple i think.

remove the newest version that has caching in it

Install a previous version without caching

I have this problem, I can't remove items added to cross sell via the control panel. This response seems to say I need to remove the contribution I installed and try another - could anyone tell me which one? I've been searching all day for a solution

 

Thanks

Link to comment
Share on other sites

I have this problem, I can't remove items added to cross sell via the control panel. This response seems to say I need to remove the contribution I installed and try another - could anyone tell me which one? I've been searching all day for a solution

 

Thanks

If it helps anyone, the problem is that my files within my cache directory are not created with permissions set to 777 - I used my control panel to change these rights - it takes and age and is a pain - certainly wont be acceptable to my user!

 

If anyone knows how to create the files with 777 permissions set I'd love to know - but this may help others with this problem.

Link to comment
Share on other sites

  • 3 weeks later...

Been searching for a couple days now and can't seem to find this.

 

I installed X-sell v2.3 (May 24th 2006 by maxime)

 

The cache files are being created, however, I am unable to delete them from the cache directory through FTP. I get a 550 /domain.com/osCtesting/cache/107/1-0.php: Permission denied

 

I have this up and running on our live store and have no problems deleting the files created in the cache. I did follow the instructions when setting up the configure.php files - the one in the Admin folder does have ../cache/ as my directory is setup as:

domain name

osCtesting (acts as the "catalog" folder)

admin

cache

includes

etc.........

 

I am guessing if my configure.php files were not setup correctly, then the contribution would not work. But the contribution is working, and I can both add and remove x-sell's through the admin interface. Which to me means that if the admin interface can create a x-sell and then remove that x-sell, then the configuration files must be correct, right??

 

Any ideas what else could cause the permissions error? The cache folder is set to 777. The folders inside of it are not created with 777 permissions, but instead they have 755. The files inside of those folders are set to 644. This is the same as it is on the live server, and I am allowed to delete, rename, etc.. on the live server via FTP.

 

Any ideas are greatly appreciated as I am running out of ideas on what in the world could be causing this. I've used WinMerge to compare both the test site & the live site files and I can't find any differences in the x-sell scripting in any of them :huh:

~Tracy
 

Link to comment
Share on other sites

Ok - I am trying to get the xsell_cart.php to use the info_box type layout just like xsell_products.php and I am running into issues.

 

This version of xsell_cart.php works for me (edited for SPPC and Master Products)

<!-- xsell_cart //-->
<?php

// 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;
}
global $customer_group_id;

 //Start an array of items being suggested.
 $xsell_contents_array = array();

 //Start to build the HTML that will display the xsell box.
 $xsell_box_contents = '';

 //Go through each item in the cart, and look for xsell products.
 foreach ($products AS $product_id_in_cart) {
// First we need to get the master_product for the product_id_in_cart
$xsell_master_query = tep_db_query("SELECT products_master FROM " . TABLE_PRODUCTS . " WHERE products_id = " . $product_id_in_cart['id'] . "");
$xsell_master = tep_db_fetch_array($xsell_master_query);

//Main XSELL Query
if ($customer_group_id != '0') {
$xsell_query = tep_db_query("SELECT p.products_master, p.products_sort_order, p.products_id, pd.products_name, p.products_image, 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 . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_XSELL . " px WHERE px.products_id = " . $xsell_master['products_master'] . " AND px.xsell_id = p.products_id AND px.xsell_id = pd.products_id AND p.products_status = '1' AND pd.language_id = '" . (int)$languages_id . "' AND pg.customers_group_id = '".$customer_group_id."' and find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 ORDER BY p.products_sort_order ASC");
} else {
$xsell_query = tep_db_query("SELECT p.products_master, p.products_sort_order, p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id FROM  " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_XSELL . " px WHERE px.products_id = " . $xsell_master['products_master'] . " AND px.xsell_id = p.products_id AND px.xsell_id = pd.products_id AND p.products_status = '1' AND pd.language_id = '" . (int)$languages_id . "' AND find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 ORDER BY p.products_sort_order ASC");
}

//Cycle through each suggested product and add to box, if there are none
//go to the next product in the cart.
while ($xsell = tep_db_fetch_array($xsell_query)) {

  //If the xsell item is already being suggested, we don't need
  //to suggest it again.  Keep track of xsell items I've already dealt
  //with.
  if (!in_array($xsell['products_id'], $xsell_contents_array)) {

	//Add this xsell product to the list of xsell products dealt with. 
	array_push($xsell_contents_array, $xsell['products_id']);  

	//If a suggested product is already in the cart, we don't need to
	//suggest it again. 
	if (!$cart->in_cart($xsell['products_id'])) {  

	  //Create the box contents.
	  $xsell_box_contents .= '<tr><td class="smallText">Qty: ' . tep_draw_input_field('cart_quantity[]', '', 'size="4"') . tep_draw_hidden_field('products_id[]',  $xsell['products_id']) . '</td>';
	$xsell_box_contents .= '<td class="smallText" width="' . SMALL_IMAGE_WIDTH . '">' . tep_image(DIR_WS_IMAGES . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</td>';
	$xsell_box_contents .= '<td class="smallText">  <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_master']) . '">' . $xsell['products_name'] . '</a></td>';
  if ($xsell_price = tep_get_products_special_price($xsell['products_id'])) {
	$products_price = '<s>' . $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($xsell_price, tep_get_tax_rate($xsell['products_tax_class_id'])) . '</span>';
   } else {
	$products_price = $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id']));
   }
   $xsell_box_contents .= '<td class="smallText" align="right">' . $products_price . '  </td>';
  }  //END OF IF ALREADY IN CART
}  // END OF IF ALREADY SUGGESTED
 }  //END OF WHILE QUERY STILL HAS ROWS
}  //END OF FOREACH PRODUCT IN CART LOOP

//Only draw the table if there are suggested products.
if ($xsell_box_contents != '') {
 echo '<br><br><table class="productListing" width="90%" cellspacing="0" cellpadding="0" align="center"><tr><td colspan="4" class="productListing-heading" align="center">May we suggest:</td></tr><tr><td colspan="4" class="smallText" align="center">Enter Quantity desired, then click "Update"</td></tr>';
 echo $xsell_box_contents . '</table>';
}

?>
<!-- xsell_cart_eof //-->

 

This is what I have so far for the xsell_cart.php using the info box layout - for some reason it won't show all of the xsell products for all of the products in the cart (minus those already listed in xsell or already in the shopping cart) unless I put the closing

 } // end of foreach product in cart loop

after the

 new contentBox($info_box_contents);

bit of code. Unfortunately though, this results in separate entire tables for each of the products in the shopping cart.

 

Here is the code I currently have:

<!-- xsell_cart //-->
<?php

// 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;
}
global $customer_group_id;

//Start an array of items being suggested.
$xsell_contents_array = array();

 //Go through each item in the cart, and look for xsell products.
 foreach ($products AS $product_id_in_cart) {
// First we need to get the master_product for the product_id_in_cart
$xsell_master_query = tep_db_query("SELECT products_master FROM " . TABLE_PRODUCTS . " WHERE products_id = " . $product_id_in_cart['id'] . "");
$xsell_master = tep_db_fetch_array($xsell_master_query);

//Main XSELL Query
if ($customer_group_id != '0') {
$xsell_query = tep_db_query("SELECT p.products_master, p.products_id, pd.products_name, p.products_image, 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 . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_XSELL . " px WHERE px.products_id = " . $xsell_master['products_master'] . " AND px.xsell_id = p.products_id AND px.xsell_id = pd.products_id AND p.products_status = '1' AND pd.language_id = '" . (int)$languages_id . "' AND pg.customers_group_id = '".$customer_group_id."' and find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 ORDER BY p.products_ordered DESC");
} else {
$xsell_query = tep_db_query("SELECT p.products_master, p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id FROM  " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_XSELL . " px WHERE px.products_id = " . $xsell_master['products_master'] . " AND px.xsell_id = p.products_id AND px.xsell_id = pd.products_id AND p.products_status = '1' AND pd.language_id = '" . (int)$languages_id . "' AND find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 ORDER BY p.products_ordered DESC");
}

//Check to see if we should show the table at all
$num_products_xsell = tep_db_num_rows($xsell_query);
if ($num_products_xsell > 0) {

	$info_box_contents = array();
	$info_box_contents[] = array('align' => 'left', 'text' => TEXT_XSELL_PRODUCTS);
	new contentBoxHeading($info_box_contents);

	$row = 0;
	$col = 0;
	$info_box_contents = array();
		//Cycle through each suggested product and add to box, if there are none
//go to the next product in the cart.
	while ($xsell = tep_db_fetch_array($xsell_query)) {

		  //If the xsell item is already being suggested, we don't need
  //to suggest it again. Keep track of xsell items I've already dealtwith.
  if (!in_array($xsell['products_id'], $xsell_contents_array)) {

	//Add this xsell product to the list of xsell products dealt with. 
	array_push($xsell_contents_array, $xsell['products_id']);  

	//if a suggested product is already in the cart, we don't need to suggest it again
	if (!$cart->in_cart($xsell['products_id'])) {

	   $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']));
	}

//create contents
	  $info_box_contents[$row][$col] = array('align' => 'center',
											 'params' => 'class="smallText" width="33%" valign="top"',
											 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_master']) . '">' . 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_master']) . '">' . $xsell['products_name'] . '</a><br>' . $xsell_price . '<br>Qty: ' . tep_draw_input_field('cart_quantity[]', '', 'size="4"') . tep_draw_hidden_field('products_id[]',  $xsell['products_id']) .'</a>');

									$col ++;
								if ($col > 2) {
									$col = 0;
									$row ++;
								} // end if ($col > 2) 

			}// end IF IN CART ALREADY
		} // end OF IF ALREADY SUGGESTED
	}// END while($xsell = tep_db_fetch_array($xsell_query)) 
}  //END if ($num_products_xsell > 0)  
}// end  OF FOREACH PRODUCT IN CART LOOP


new contentBox($info_box_contents);
?>
<!-- xsell_cart_eof //-->

 

Does anybody see what it is I need to do in order to get the correct products all into one infobox table? It all works properly in the first script - but I wanted to use the info_box_contents script as it shows the products in columns as well.

 

PS - I do still have the permissions error from the above post - anybody out there got any ideas?

Edited by TracyS

~Tracy
 

Link to comment
Share on other sites

  • 4 weeks later...
} //END if ($num_products_xsell > 0)

}// end OF FOREACH PRODUCT IN CART LOOP

 

 

new contentBox($info_box_contents);

 

From your description I would suggest this untested solution:

 

} //END if ($num_products_xsell > 0)

$info_box_contents_total .= $info_box_contents

}// end OF FOREACH PRODUCT IN CART LOOP

 

 

new contentBox($info_box_contents_total);

 

I am assuming that you are getting only data out relating to the last loop, but if I understand your description this should fix the issue.

 

Somewhere on top of the file you may want to add $info_box_contents_total = ''; to ensure it starts empty.

Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...

Prioritize Bug?

 

I have installed v2.4 of the cross sell, and I'm having an issue with the Prioritize function.

 

Say I have a series of t-shirts that I want to xsell. (Yes I know that I could use attributes here, but this is just an example)

 

One Black Style, small medium large xlarge

One White Style, small medium large xlarge

 

 

I set up a xsell for the small White with all of the others as xsells and prioritize like this: 1-white medium, 2-white large, 3-white xlarge, 4-black small, 5-black medium, 6-black-large, 7-black xlarge

 

Then I set up a xsell for the Black Small with all the others as xsells and prioritize like this: 1-black medium, 2-black large, 3-black xlarge, 4-white small, 5-white medium, 6-white -large, 7-white xlarge

 

 

Here is the problem. When I prioritize one with the same xsell items, it overrides the xsell priority for the other product. It's as if each product can have only one priority assigned to it no matter where it is used, rather than have independent priorities.

 

Is this a bug, or a feature I'm not getting?

Link to comment
Share on other sites

  • 2 months later...

I am pretty new to all of this stuff....

 

I want to make the xsell admin add a reciprical cross sell entry to every product entered.... What I mean by that is, if I enter products B and C as cross sell items to product A, then at the same time I want to add A as a cross sell item to B and C. I'll work on making it optional later....

 

Anyway, I was wondering if anyone had any thoughts about where I can get started on this. I'm assuming that I need to dig in xsell.php, but I'm curious if what I want to do is feasible (from someone that is familiar with that module).

 

Thanks for your input!

Moez

Link to comment
Share on other sites

  • 2 weeks later...

Hi Everyones,

 

First I want to say that this contribution is great.

 

But this cache is not the best solution if you have change of the prices.

Next my question is thqt is it possible to random products from added as cross?

Let say that I have added 10 products but I adjusted max display 6 of them so the first six zill be displayed regarding the priority. But the better solution can be choose between randomisation or standard version...

 

Thanks for answer and sorry for my English

Link to comment
Share on other sites

  • 1 month later...

Hi

 

How do I change the width of the x-sell table (ex. "width=50%") - I would like to make it smaller.

 

Below is the source code from my page - (http://www.babygear.dk/aqua-baby-banz-p-98.html)

 

/Jesper

 

 

<!-- start xsell //-->

<img src="images/infobox/corner_left.gif" border="0" alt="" width="1" height="1"></td>

<td height="14" class="infoBoxHeading" width="100%">We Also Recommend :</td>

<td height="14" class="infoBoxHeading"><img src="images/infobox/corner_right_left.gif" border="0" alt="" width="1" height="1"></td>

</tr>

</table>

<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="4" class="infoBoxContents">

<tr>

<td align="center" class="smallText" width="33%" valign="top"><a href="http://www.babygear.dk/blaa-camo-baby-banz-p-92.html"><img src="images/babybanz_blaa-camo.jpg" border="0" alt="Blå Camo Baby Banz" title=" Blå Camo Baby Banz " width="171" height="150"></a><br><a href="http://www.babygear.dk/blaa-camo-baby-banz-p-92.html">Blå Camo Baby Banz</a><br>kr.149,-<br><a href="http://www.babygear.dk/aqua-baby-banz-p-98.html?product_to_buy_id=92&action=buy_now"><img src="includes/languages/danish/images/buttons/button_buy_now.gif" border="0" alt="Buy 1 'Blå Camo Baby Banz' now" title=" Buy 1 'Blå Camo Baby Banz' now " width="36" height="36"></a></td>

<td align="center" class="smallText" width="33%" valign="top"><a href="http://www.babygear.dk/isofix-base-p-75.html"><img src="images/isofix_recaro.jpg" border="0" alt="Isofix Base" title=" Isofix Base " width="171" height="150"></a><br><a href="http://www.babygear.dk/isofix-base-p-75.html">Isofix Base</a><br><s>kr.1.098,-</s><br><span class="productSpecialPrice">kr.849,-</span><br><a href="http://www.babygear.dk/aqua-baby-banz-p-98.html?product_to_buy_id=75&action=buy_now"><img src="includes/languages/danish/images/buttons/button_buy_now.gif" border="0" alt="Buy 1 'Isofix Base' now" title=" Buy 1 'Isofix Base' now " width="36" height="36"></a></td>

<td align="center" class="smallText" width="33%" valign="top"><a href="http://www.babygear.dk/recaro-monza-p-104.html"><img src="images/monza black aquavit.jpg" border="0" alt="Recaro Monza" title=" Recaro Monza " width="171" height="150"></a><br><a href="http://www.babygear.dk/recaro-monza-p-104.html">Recaro Monza</a><br><s>kr.1.698,-</s><br><span class="productSpecialPrice">kr.1.298,-</span><br><a href="http://www.babygear.dk/aqua-baby-banz-p-98.html?product_to_buy_id=104&action=buy_now"><img src="includes/languages/danish/images/buttons/button_buy_now.gif" border="0" alt="Buy 1 'Recaro Monza' now" title=" Buy 1 'Recaro Monza' now " width="36" height="36"></a></td>

</tr>

</table>

 

<!-- end xsell //-->

Link to comment
Share on other sites

  • 1 month later...

Hi

Can anyone help, I have double checked everything and still get this database error at the bottom of product pages.

 

I have also changed admin/xsell.php incase i have older php (as per your very early post about php versions) but still get same error

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MAX_DISPLAY_XSELL' at line 7

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 products_xsell xp left join products p on xp.xsell_id = p.products_id left join products_description pd on p.products_id = pd.products_id and pd.language_id = '1' left join specials s on p.products_id = s.products_id where xp.products_id = '20' and p.products_status = '1' order by sort_order asc limit MAX_DISPLAY_XSELL

[TEP STOP]

 

thanks in advance

steve

Link to comment
Share on other sites

  • 1 month later...
Hi

Can anyone help, I have double checked everything and still get this database error at the bottom of product pages.

 

I have also changed admin/xsell.php incase i have older php (as per your very early post about php versions) but still get same error

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MAX_DISPLAY_XSELL' at line 7

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 products_xsell xp left join products p on xp.xsell_id = p.products_id left join products_description pd on p.products_id = pd.products_id and pd.language_id = '1' left join specials s on p.products_id = s.products_id where xp.products_id = '20' and p.products_status = '1' order by sort_order asc limit MAX_DISPLAY_XSELL

[TEP STOP]

 

thanks in advance

steve

 

did you add sql code to the database?

Link to comment
Share on other sites

  • 1 month later...

Found a glitch that would allow the Specials price to show up in the XSell even if it had expired or was turned off.

 

catalog/includes/modules/xsell_products.php

 

Line 22, Find:

	$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

 

Replace with:

 

	$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

 

(removed the last ", specials_new_products_price")

Link to comment
Share on other sites

  • 1 month later...

Hello,

 

I'm having a hard time understanding the cache system. I have modified x-sell to work with SPPC and now when testing this contribution I see that the x-sell products are not reflecting the correct prices to my different customer groups because of the cache system.

 

Is there a way to not use the cache system for x-sell? If so, what lines of code need to be removed?

 

Any guidance would be appreciated. Thanks.

Link to comment
Share on other sites

Hi,

 

I may have found a workaround for the cache issue but I'm now I'm having issues with the SPPC pricing. I will also post this in the SPPC forum but I thought that there might be someone here that could help as well...

 

I can get the proper regular pricing to show up on my x-sell items for all customer groups but I cannot get the specials to show up correctly (ie. when I set a special for only "wholesale" it will show up for all groups on the x-sell items). Does anyone have a clue how to correct this?

 

This is the code from my includes/modules/xsell_products.php file:

 

<?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 © 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();
}

// 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;
}
global $customer_group_id;

if ($HTTP_GET_VARS['products_id']) {

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' order by sort_order asc limit " . MAX_DISPLAY_XSELL);
} else {
   $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
   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);
}
// 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 contentBoxHeading($info_box_contents);

    $row = 0;
    $col = 0;
    $info_box_contents = array();
    while ($xsell = tep_db_fetch_array($xsell_query)) {
           if (tep_not_null($xsell['specials_new_products_price'])) {
               $xsell_price =  '<s>' . $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</s> ';
          $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']));
           }
      $text = '<table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>
   <td class="main" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']) . '">' . $xsell['products_name'] .'</a></td>
 </tr>
 <tr>
   <td align="center"><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></td>
 </tr>
 <tr>
   <td class="main" align="center">' . $xsell_price . '</td>
 </tr>
 <tr>
   <td class="main" align="center"><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></td>
 </tr>
</table>';
      $info_box_contents[$row][$col] = array('align' => 'center',
                                             'params' => 'class="smallText" width="33%" valign="top"',
                                             'text' => $text) ; 
      $col ++;
      if ($col > 2) {
        $col = 0;
        $row ++;
      }
    }
new contentBox($info_box_contents);
?>
<!-- xsell_products_eof //-->
<?php
  }
}
?>

Edited by DimeNote
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Hi, I installed X-sell V2.6 and am having a little bit of trouble. It works overall, but for some reason, with Internet Explorer 8 when the X-Sell box shows up on the catalog screen, the entire right column (shopping cart, notifications, reviews, tell-a-friend, languages, and currency boxs)is shifted underneath the X-sell box. This is not occuring using Firefox, which displays three columns just fine. Anyone else having this issue? Where do I look for a coding change. I am using STS, and many other add-ons, but maybe only STS would involve how the display looks. What files control the screen output?

 

Thanks for any help.

Link to comment
Share on other sites

  • 2 months later...

Hello,

This may be a stupid question but I see that there are two contributions doing the same or similar thing:

1. X-Sell v2-MS2 - Cross Sell for MS2 (this one)

2. Optional Related Products

 

Can you tell me what the differences are and if this one is better than the other one?

 

Thank you,

Kevin

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