Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Bob,

im curious.....why does the '== 1' method work when not logged in?
That is because when you are not logged in, the $_SESSION['sppc_customer_group_id'] is not set. Being not set is also "not '0'" so that evaluates to TRUE.
Link to comment
Share on other sites

Jan,

 

Can you suggest a way for me to implement the "Hide Price if $0" modification" in the additional files I have that show prices.

 

I cannot get:

 

 if($pf->thePrice > 0) {

 

by itself to distinguish the prices in my extra files, as it does in product_info.php.

 

Carlos

Link to comment
Share on other sites

Carlos,

Can you suggest a way for me to implement the "Hide Price if $0" modification" in the additional files I have that show prices.
Did you take a look at that contribution already? That $pf-> stuff is from the Price Break contribution but there are indeed a lot more places where a price can come up.
Link to comment
Share on other sites

Hey Jan-

 

I'm trying to come up with some code for checkout_confirmation.php that would dump a retail customer back to checkout_shipping.php if no shipping method was selected.

 

Here's my idea:

 

// if retail customer has not selected shipping method redirect them to shipping page
global $sppc_customer_group_id;
if (!tep_session_is_registered('sppc_customer_group_id')) {
  $customer_group_id = '0';
} else {
  $customer_group_id = $sppc_customer_group_id;
}

if (($customer_group_id == '0') && ($shipping_cost == 0)) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}

 

I put this directly above

 

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

 

I've tested it out and it works ok- I wanted to post it in case someone else was looking for something similar and also to get your thoughts on it.

 

The only problem with it is that it makes it impossible to offer free shipping for retail customers, but since I don't foresee doing that anytime soon that is not an immediate problem for me. I'd like it to be a little more robust than that, and only dump the retail customer back if no shipping method were selected on the shipping page (for instance when using UPS or FedEx and no rates are returned) and so still allow for free shipping.

 

I've found

 

// if no shipping method has been selected, redirect the customer to the shipping method selection page
 if (!tep_session_is_registered('shipping')) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
 }

 

to be of little value in this.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Actually it doesn't work ok- if someone is dumped back to the shipping page this way then selects a shipping method, they're dumped back again anyway and so get stuck in a loop.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Did anybody happen to ever integrate SPPC into "Multi-Product Update v1.00" contrib?

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

 

Im using version 1.1(13 Feb 2005) and would love to be able to edit my other group prices with it also. Theres only two files that do all the work(one just defines the English stuff).

 

Here's the main file:

<?php
/*
 $Id: product_updates.php,v 1.1 2005/02/12 Exp $

 osCommerce
 http://www.oscommerce.com

 Copyright (c) 2005

 Released under the GNU General Public License\
*/

 require('includes/application_top.php');
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 if ($HTTP_GET_VARS['action'] == 'update') {
foreach ($_POST['event_record'] as $id => $row) {
tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_price = '" . $row['products_price'] . "', products_weight = '" . $row['products_weight'] . "', products_quantity = '" . $row['products_quantity'] . "' where products_id = '" . $row['products_id'] . "'");
$products_updated = true;
}
  if ($products_updated == true) {
	$messageStack->add_session(SUCCESS_PRODUCTS_UPDATED, 'success');
  } else {
	$messageStack->add_session(WARNING_PRODUCTS_NOT_UPDATED, 'warning');
  }
tep_redirect(tep_href_link(FILENAME_PRODUCT_UPDATES));
 }

 if ($HTTP_GET_VARS['action'] == 'export') {
  $csv_output = TABLE_HEADING_PRODUCT_ID . "," . TABLE_HEADING_PMAN . "," . TABLE_HEADING_PNAME . "," . TABLE_HEADING_PMODEL . "," . TABLE_HEADING_PPRICE . "," . TABLE_HEADING_PWEIGHT . "," . TABLE_HEADING_PQTY;
  $csv_output .= "\n";
  $csv_query = tep_db_query("select p.products_id, p.manufacturers_id, p.products_quantity, p.products_price, p.products_weight, p.products_model, pd.products_name, m.manufacturers_id, m.manufacturers_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_id = pd.products_id and p.manufacturers_id = m.manufacturers_id group by pd.products_name order by pd.products_name ASC");
  while ($csv = tep_db_fetch_array($csv_query)) {
   $csv_output .= $csv['products_id'] . "," . $csv['manufacturers_name'] . "," . $csv['products_name'] . "," . $csv['products_model'] . "," . $currencies->format($csv['products_price']) . "," . $csv['products_weight'] . "," . $csv['products_quantity'] . "\n";
  }
  $saveas = 'product_stock-price_report_' . strftime("%m-%d-%Y");
  header("Content-Disposition: attachment; filename=$saveas.csv");
  print $csv_output;
  exit;
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script type="text/javascript" language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"><?php echo tep_draw_form('stockprice', FILENAME_PRODUCT_UPDATES, 'action=update', 'post'); ?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>

		   <?php
	  switch ($listing) {
		  case "prod":
		  $order = "p.products_id";
		  break;
		  case "prod-desc":
		  $order = "p.products_id DESC";
		  break;
		  case "manu":
		  $order = "m.manufacturers_name";
		  break;
		  case "manu-desc":
		  $order = "m.manufacturers_name DESC";
		  break;
		  case "name":
		  $order = "pd.products_name";
		  break;
		  case "name-desc":
		  $order = "pd.products_name DESC";
		  break;
	  case "model":
		  $order = "p.products_model";
		  break;
		  case "model-desc":
		  $order = "p.products_model DESC";
		  break;
	  case "quantity":
		  $order = "p.products_quantity";
		  break;
		  case "quantity-desc":
		  $order = "p.products_quantity DESC";
		  break;
	  case "weight":
		  $order = "p.products_weight";
		  break;
		  case "weight-desc":
		  $order = "p.products_weight DESC";
		  break;
	  case "price":
		  $order = "p.products_price";
		  break;
		  case "price-desc":
		  $order = "p.products_price DESC";
		  break;
		  default:
		  $order = "p.products_model ASC";
	  }
	  ?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr class="dataTableHeadingRow">
			<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=prod"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PRODUCT_ID . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=prod-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PRODUCT_ID . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PRODUCT_ID; ?></td>
			<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=manu"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PMAN . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=manu-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PMAN . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PMAN; ?></td>
			<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=name"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PNAME . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=name-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PNAME. ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PNAME; ?></td>
			<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=model"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PMODEL . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=model-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PMODEL . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PMODEL; ?></td>
			<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=weight"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PWEIGHT . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=weight-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PWEIGHT . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PWEIGHT; ?></td>
			<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=price"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PPRICE . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=price-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PPRICE . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PPRICE; ?></td>
			<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?listing=quantity"; ?>"><?php echo tep_image_button('ic_up.gif', ' Sort ' . TABLE_HEADING_PQTY . ' --> A-B-C From Top '); ?></a> <a href="<?php echo "$PHP_SELF?listing=quantity-desc"; ?>"><?php echo tep_image_button('ic_down.gif', ' Sort ' . TABLE_HEADING_PQTY . ' --> Z-X-Y From Top '); ?></a><br><?php echo TABLE_HEADING_PQTY; ?></td>
		  </tr>

<?php
 $countrows_query = tep_db_query("select * from " . TABLE_PRODUCTS . "");
 $countrows = tep_db_num_rows($countrows_query);
 $updates_raw = "select p.products_id, p.manufacturers_id, p.products_quantity, p.products_weight, p.products_price, p.products_model, pd.products_name, m.manufacturers_id, m.manufacturers_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_id = pd.products_id and p.manufacturers_id = m.manufacturers_id group by pd.products_name order by $order";
 $updates_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $updates_raw, $countrows);
$updates = tep_db_query($updates_raw);
  while ($row = tep_db_fetch_array($updates)) {
	$id = $row['products_id'];
	$updates_pman = $row['manufacturers_name'];
	$updates_pname = $row['products_name'];
	$updates_pmodel = $row['products_model'];
	$updates_pweight = $row['products_weight'];
	$updates_pprice = $row['products_price'];
	$updates_pqty = $row['products_quantity'];
?>
		  <tr class="dataTableRow">
			<td class="dataTableContent"><?php echo $row['products_id'] . "<input type='hidden' name='event_record[" . $id . "][products_id]' value='".$id."'>"; ?></td>
			<td class="dataTableContent"><?php echo $row['manufacturers_name']; ?></td>
			<td class="dataTableContent"><?php echo '<a href="' . tep_catalog_href_link('product_info.php', 'products_id=' . $row['products_id']) . '">' . $row['products_name'] . '</a>'; ?></td>
			<td class="dataTableContent"><?php echo $row['products_model']; ?></td>
			<td class="dataTableContent"><?php echo tep_draw_input_field('event_record[' . $id . '][products_weight]', $row['products_weight'], 'size="6"'); ?></td>
			<td class="dataTableContent"><?php echo tep_draw_input_field('event_record[' . $id . '][products_price]', $row['products_price'], 'size="6"'); ?></td>
			<td class="dataTableContent"><?php echo tep_draw_input_field('event_record[' . $id . '][products_quantity]', $row['products_quantity'], 'size="6"'); ?></td>
		  </tr>
<?php
 }
?>
		  <tr>
			<td colspan="6"><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
		  </tr>
		  <tr>
			<td colspan="3" align="left"><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?></form></td>
			<td colspan="3" align="right"><?php echo tep_draw_form('stockprice_report', FILENAME_PRODUCT_UPDATES, 'action=export', 'post'); ?><?php echo tep_image_submit('button_save.gif', IMAGE_SAVECSV); ?></form></td>
		  </tr>
		  <tr>
			<td colspan="6"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
		  </tr>
		  <tr>
			<td class="smallText" align="left" colspan="3"><?php echo $updates_split->display_count($countrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
			<td class="smallText" align="right" colspan="3"><?php echo $updates_split->display_links($countrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'x', 'y', 'products_id'))); ?> </td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
</table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Mucho thanks to anybody that can help out :thumbsup:

Edited by Sid04
Link to comment
Share on other sites

Note on above. There is an export function included in this contrib(exports to .csv file). Im not so much interested in that as I am being able to change the SPPC group prices in the form created by this contrib in the admin. Thanks again for any help

Link to comment
Share on other sites

Actually it doesn't work ok- if someone is dumped back to the shipping page this way then selects a shipping method, they're dumped back again anyway and so get stuck in a loop.
Hmm, $shipping_cost is a variable that I could only find in includes/modules/shipping/zones.php. That variable might not be available on all pages. I would say that the session variable shipping is the way to go to find out if someone has selected a shipping method...
Link to comment
Share on other sites

Hmm, $shipping_cost is a variable that I could only find in includes/modules/shipping/zones.php. That variable might not be available on all pages. I would say that the session variable shipping is the way to go to find out if someone has selected a shipping method...

 

What sets the shipping session variable?

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Great Contribution Thanks!

 

I am also using ## POINTS AND REWARDS MODULE V1.00 ##

(http://www.oscommerce.com/community/contributions,3220)

 

My problem: The points & rewards module awards point to RETAIL customers only. If you are a wholesale customert you receive sign-up points but nothing when shopping. The author (DEEP-SILVER) is not familiar with the SPPC contribution and could not help.

 

Do you have any suggestions?

 

Once again, thanks for a great contribution.

Link to comment
Share on other sites

Hey,

 

Currently using SPPC and Price Break for SPPC.

 

Has anyone been able to get [Contribution] Purchase Order V2.3 or Dangling Carrot (Free Gift/Discount Contrib) contributions to work alongside SPPC?

 

I really need to have a credit account on my site and if possible a free gift contribution that works with SPPC.

 

Regards

 

M Parmar

Link to comment
Share on other sites

I have posted to another forum topic here with little response.. nothing helpful at all except "add the field to EP"

 

http://www.oscommerce.com/forums/index.php?act...ndpost&p=723748

 

I'm trying to figure out how to add the Hide Products from Customer Groups into Easy Populate.. at least 1/3 of 3000 items will need to be hidden.. way to time consumig to do it manually..

 

I'm in a time crunch now.. can someone please help?? thanks!

Edited by wkdwich

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

I DID IT!!! :P :P :P :P

 

I fooled with it ONE MORE time and after just a bit of aggrivation I DID IT!!!!

 

EZ Populate now recognizes the products_hide_from_groups column in the products data base!!!

 

I will add it to the EP contribution now

 

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

 

I am so proud of myself for being able to contribute to this forum!!

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

Hey,

 

Currently using SPPC and Price Break for SPPC.

 

Has anyone been able to get [Contribution] Purchase Order V2.3 or Dangling Carrot (Free Gift/Discount Contrib) contributions to work alongside SPPC?

 

I really need to have a credit account on my site and if possible a free gift contribution that works with SPPC.

 

Regards

 

M Parmar

 

Parma,

 

I use the contribution Purchase Orders 1.4 who work very well with SPPC. Take a look on that. Simple to install too. For the contibution gift, I don't know because I don't use this.

John

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

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

My problem: The points & rewards module awards point to RETAIL customers only. If you are a wholesale customert you receive sign-up points but nothing when shopping. The author (DEEP-SILVER) is not familiar with the SPPC contribution and could not help.
I'm not familiar with his contribution :D

 

Anyway, I don't see why this shouldn't work for other customer groups. I downloaded the full 1.5 zip and looked around for anything suspicious.

 

I noticed a function in includes/functions/redemptions.php which I

A. found rather odd since when any product in the shopping basket has a special price, no points are rewarded... OK

B. that happens for your wholesale customer too since the product price in his shopping basket is lower than the products price for retail (see the last lines in the code below).

 

So I suggest you try this (starts around line 225 in redemptions.php):

**CHANGE**
function get_points_rules_discounted($order) {

 if (REDEMPTION_DISCOUNTED == 'true') {  

  for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
	   $id = $order->products[$i]['id'];
	   $product_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . $id . "' and products_status = 1");
	   $product = tep_db_fetch_array($product_query);		 if (!(substr($order->products[$i]['price'],0,10) == $product['products_price'])) {
		return false;

TO:

function get_points_rules_discounted($order) {

 if (REDEMPTION_DISCOUNTED == 'true') {

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

  for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
	   $id = $order->products[$i]['id'];
   if ($customer_group_id == '0') {
	   $product_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . $id . "' and products_status = 1");
   } else {
	   $product_query = tep_db_query("select customers_group_price AS products_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $id . "' and customers_group_id =  '" . $customer_group_id . "'");		   
   }
// EOF Separate Pricing Per Customer 
	   $product = tep_db_fetch_array($product_query);
	 if (!(substr($order->products[$i]['price'],0,10) == $product['products_price'])) {
		return false;

I haven't installed this rather large contribution, so haven't been able to test this. I think there is room for improvement too in this contribution. It uses an sql-query for every single product in the shopping basket. Can be made more efficient. But first let see if this works.

 

Another function that might need updating is get_award_discounted($order) (around line 135). You can do that following the example code above.

Link to comment
Share on other sites

Stew,

What sets the shipping session variable?
That is done on the page checkout_shipping, what is added to the session variables is (example):

	[shipping] => Array
	(
		[id] => flat_flat
		[title] => Flat Rate (Best Way)
		[cost] => 4.65
	)

You can see for yourself if you add this to the footer in checkout_payment.php:

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); 
echo '<pre>Session variables:<br>';
print_r($_SESSION);
?>
<!-- footer_eof //-->

You can check for what shipping method was chosen by echoing: $_SESSION['shipping']['id'] (flat_flat in this case).

Link to comment
Share on other sites

Stew,

That is done on the page checkout_shipping, what is added to the session variables is (example):

	[shipping] => Array
	(
		[id] => flat_flat
		[title] => Flat Rate (Best Way)
		[cost] => 4.65
	)

You can see for yourself if you add this to the footer in checkout_payment.php:

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); 
echo '<pre>Session variables:<br>';
print_r($_SESSION);
?>
<!-- footer_eof //-->

You can check for what shipping method was chosen by echoing: $_SESSION['shipping']['id'] (flat_flat in this case).

 

Important information that I have until now failed to disclose: I'm using Multi Vendor Shipping. Apparently using this contribution changes the way the shipping session is set? I've asked the developers about the code that checks for the shipping session having been set and they told me that it's basically worthless (when using MVS). I'm thinking what happens is that using MVS automatically sets the shipping session variable?

 

Anyway that's why I need more robust code. I want to give my wholesale customers free shipping every time and I don't foresee ever giving free shipping to my retail customers, so that's where SPPC comes in.

 

The shipping cost as displayed on checkout_confirmation must be defined by a variable, right? It just seems like there's some way of writing the code so that if the customer is retail and nothing is returned for shipping cost then the user is returned to checkout_shipping.

 

This code works, incidentally, just that the user then gets stuck in a loop. A user who doesn't somehow skip picking a shipping method doesn't get stuck in the loop.

 

I'll run it by the MVS guys too.

 

Thanks Jan.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

How about this:

 

// if retail customer has not selected shipping method redirect them to shipping page
global $sppc_customer_group_id;
if (!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
} else {
 $customer_group_id = $sppc_customer_group_id;
}

if (($customer_group_id == '0') && ($order->info['shipping_cost'] == 0)) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Stew,

 if (($customer_group_id == '0') && ($order->info['shipping_cost'] == 0)) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}

That could work, but I don't know what $order->info['shipping_cost'] looks like when shipping was skipped. It could be just empty: '' or not set (worse). You can see what it is by using print_r($order) in that snippet I gave. Or to catch the empty state using:

 if (($customer_group_id == '0')&& ((int)$order->info['shipping_cost'] == 0)) {tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}

Link to comment
Share on other sites

Stew,

 if (($customer_group_id == '0') && ($order->info['shipping_cost'] == 0)) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}

That could work, but I don't know what $order->info['shipping_cost'] looks like when shipping was skipped. It could be just empty: '' or not set (worse). You can see what it is by using print_r($order) in that snippet I gave. Or to catch the empty state using:

 if (($customer_group_id == '0')&& ((int)$order->info['shipping_cost'] == 0)) {tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}

 

Not quite- that prevents checkout whenever the shipping total is <1.

 

Based on my tests ($order->info['shipping_cost'] == 0) works for both zero price and null returns.

 

 

 

think adding an SPPC group column will be possible for the contrib mentioned here, or does anybody have a simliar contrib that is already hacked to work with SPPC? Its like easy populate except you edit teh prices in a form in admin instead of excel.

 

http://www.oscommerce.com/forums/index.php?sho...=53436&st=1580#

 

thanx

 

What contribution is it that you're asking after?

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

This did not work, But you are right-on with your thought about not allowing discounted items to be awarded points. I thought about your comment and went to the admin and changed the discounted items option to TRUE. Guess what? Wholesale now receives points. Unfortunately I will never be able to run specials on my prducts like this.

 

Do you have another suggestion?

 

Thanks for your help.

 

I'm not familiar with his contribution :D

 

Anyway, I don't see why this shouldn't work for other customer groups. I downloaded the full 1.5 zip and looked around for anything suspicious.

 

I noticed a function in includes/functions/redemptions.php which I

A. found rather odd since when any product in the shopping basket has a special price, no points are rewarded... OK

B. that happens for your wholesale customer too since the product price in his shopping basket is lower than the products price for retail (see the last lines in the code below).

 

So I suggest you try this (starts around line 225 in redemptions.php):

**CHANGE**
function get_points_rules_discounted($order) {

 if (REDEMPTION_DISCOUNTED == 'true') {  

  for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
	   $id = $order->products[$i]['id'];
	   $product_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . $id . "' and products_status = 1");
	   $product = tep_db_fetch_array($product_query);		 if (!(substr($order->products[$i]['price'],0,10) == $product['products_price'])) {
		return false;

TO:

function get_points_rules_discounted($order) {

 if (REDEMPTION_DISCOUNTED == 'true') {

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

  for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
	   $id = $order->products[$i]['id'];
   if ($customer_group_id == '0') {
	   $product_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . $id . "' and products_status = 1");
   } else {
	   $product_query = tep_db_query("select customers_group_price AS products_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $id . "' and customers_group_id =  '" . $customer_group_id . "'");		   
   }
// EOF Separate Pricing Per Customer 
	   $product = tep_db_fetch_array($product_query);
	 if (!(substr($order->products[$i]['price'],0,10) == $product['products_price'])) {
		return false;

I haven't installed this rather large contribution, so haven't been able to test this. I think there is room for improvement too in this contribution. It uses an sql-query for every single product in the shopping basket. Can be made more efficient. But first let see if this works.

 

Another function that might need updating is get_award_discounted($order) (around line 135). You can do that following the example code above.

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