Jump to content
dreamscape

[Contribution] Cross Sell (X-Sell) Admin

Recommended Posts

in admin/categories.php

 

Find(1131):

 $contents[] = array('align' => 'center', 'text' => tep_draw_button(IMAGE_EDIT, 'document', tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=new_product')) . tep_draw_button(IMAGE_DELETE, 'trash', tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=delete_product')) . tep_draw_button(IMAGE_MOVE, 'arrow-4', tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=move_product')) . tep_draw_button(IMAGE_COPY_TO, 'copy', tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=copy_to')));

replace:

$contents[] = array('align' => 'center', 'text' => tep_draw_button(IMAGE_EDIT, 'document', tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=new_product')) . tep_draw_button(IMAGE_DELETE, 'trash', tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=delete_product')) . tep_draw_button(IMAGE_MOVE, 'arrow-4', tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=move_product')) . tep_draw_button(IMAGE_COPY_TO, 'copy', tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=copy_to')). tep_draw_button(IMAGE_RELATED_PRODUCTS, 'transfer-e-w', tep_href_link(FILENAME_XSELL_PRODUCTS, 'add_related_product_ID=' . $pInfo->products_id ), null, array('newwindow' => true)));
			

Share this post


Link to post
Share on other sites

Anyone knows why x-sell redirects to index page after Buy Now is clicked?

 

Item does get added to cart though, no messagestack shown and goes to index page

Double checked install instructions, using 2.3.4 edge

Admin settings for Display Cart After Adding Product = false


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites

Ok, bump on this one

The Add to cart buttons not correct in this one - old version but was not updated

I'm struggling to fix that part - see code

<?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
*/
//fixed bug
//require('includes/languages/' . $language . '/' . FILENAME_XSELL_PRODUCTS);

  //  global variable (session): $sppc_customers_group_id -> local variable $customer_group_id
  if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
    $customer_group_id = $_SESSION['sppc_customer_group_id'];
  } else {
    $customer_group_id = '0';
  }
  
if ((USE_CACHE == 'true') && empty($SID)) {
	// include currencies class and create an instance
	require_once(DIR_WS_CLASSES . 'currencies.php');
	$currencies = new currencies();
}

if ($_GET['products_id']) {

	//$xsell_query = tep_db_query("select distinct p.products_id, p.products_image, p.image_folder, p.image_display, 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
	//fixed bug
//	$xsell_query = tep_db_query("select distinct p.products_id, p.products_image, p.image_folder, p.image_display, pd.products_name, p.products_tax_class_id, products_price, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price
	$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 = '" . $_GET['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) {
?>
<!-- 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 ($customer_group_id < '1') { 
				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><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']));
			}
			if ($xsell['products_image'] == 1) {
				$text = '<a href="' . tep_href_link('product_info.php', 'products_id=' . $xsell['products_id']) . '">' . tep_image('includes/languages/' . $language . '/images/' . 'no_picture.gif', TEXT_NO_PICTURE, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link('product_info.php', 'products_id=' . $xsell['products_id']) . '">' . $xsell['products_name'] .'</a><br>' . $xsell_price. '<br><a href="' . tep_href_link('product_info.php', 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( 'product_info.php', tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $xsell['products_id']));
			} elseif (($xsell['products_image'] != 2) && tep_not_null($xsell['products_image'])) {
				$text = '<a href="' . tep_href_link('product_info.php', 'products_id=' . $xsell['products_id']) . '">' . tep_image('images/' . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link('product_info.php', 'products_id=' . $xsell['products_id']) . '">' . $xsell['products_name'] .'</a><br>' . $xsell_price. '<br><a href="' . tep_href_link('product_info.php', 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( 'product_info.php', tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $xsell['products_id']));
			}
	   $info_box_contents[$row][$col] = array('align' => 'center',
                                              'params' => 'class="smallText" width="33%" valign="top"',
                                              'text' => $text) ; 
	   $col ++;
       if ($col > 2) {
         $col = 0;
         $row ++;
       }
 	}
	
  else if ($customer_group_id > '1') { 

  			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><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']));
			}
			if ($xsell['image_display'] == 1) {
				$text = '<a href="' . tep_href_link('product_info.php', 'products_id=' . $xsell['products_id']) . '">' . tep_image('includes/languages/' . $language . '/images/' . 'no_picture.gif', TEXT_NO_PICTURE, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link('product_info.php', 'products_id=' . $xsell['products_id']) . '">' . $xsell['products_name'] .'</a>>';
			} elseif (($xsell['image_display'] != 2) && tep_not_null($xsell['products_image'])) {
				$text = '<a href="' . tep_href_link('product_info.php', 'products_id=' . $xsell['products_id']) . '">' . tep_image('images/' . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link('product_info.php', 'products_id=' . $xsell['products_id']) . '">' . $xsell['products_name'] .'</a>';
			}
	   $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);
//new contentBoxStart($info_box_contents);
?>
<div class="ui-widget infoBoxContainer">
    <div class="ui-widget-header ui-corner-top infoBoxHeading">
      <span><?php echo TEXT_XSELL_PRODUCTS; ?></span>
    </div>

    <?php new contentBoxStart($info_box_contents); ?>
  </div>

<!-- xsell_products_eof //-->
<?php
 	 }   
 }
?>

 


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites

Whilst I appreciate that there has been no real development of this for a long time, is anyone working on getting this ready for Phoenix version 1.0.5.0.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites
Posted (edited)

related products does the same and is updated for phoenix 1.0.5.0.

https://apps.oscommerce.com/3HFGv&related-products-phoenix&v=cephoenix10&p=3

Edited by raiwa

Share this post


Link to post
Share on other sites
1 hour ago, raiwa said:

related products does the same and is updated for phoenix 1.0.5.0.

https://apps.oscommerce.com/3HFGv&related-products-phoenix&v=cephoenix10&p=3

Many thanks. Is it as easy to use with setting up multiple cross sells and reciprocal multiple cross sells, and can it be made to work with the database from this addon. I have over 2500 products with cross sells and dont really want to have to enter them again.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites
11 hours ago, 14steve14 said:

Many thanks. Is it as easy to use with setting up multiple cross sells and reciprocal multiple cross sells, and can it be made to work with the database from this addon. I have over 2500 products with cross sells and dont really want to have to enter them again.

I never used this cross sell addon and can't say the differences in the db tables. On admin side it has reciprocal and heritance options when you setup a new related product pair.

There is also a Pro version available which allows to filter by catgegories on the admin page.

For the db I would recommend to install related products on a develop store, Installation is very easy.

Then you can compare the db tables ands see if you can convert your existing cross sell table to related products table.

Share this post


Link to post
Share on other sites

Rainer. Thanks very much. I will take a look. Hopefully it will be suitable. If not it may be made to work, or playing around and thinking way above my pay grade it may be possible to use the back end from one and the front end from another and mix and match them both to get the best of both worlds. Will give me something to do if it ever gets quiet here.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

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

×