Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

any idea? I notice nothing different then before I did any of this.
Sounds like the wrong module is used. You should see three products in each row with a style="padding-top: 5px;" for the buy now button. If you can't find that style statement in the HTML source code, the wrong module is used.

 

Stew is right, it must be something silly that went wrong.

Share this post


Link to post
Share on other sites

well, something silly def happened.....just not sure what.

 

I went ahead and worked on the "Show Price list for SPPC 4.1 v1.0" contrib. After it was installed the columns started showing properly. I think it was something weird server side, totally non-related to the contrib obviously. Thanks guys

Share this post


Link to post
Share on other sites

Hello Jan,

 

I was wondering if when you had some moments, you could take a look at my bestsellers.php & shop_by_price.php infobox files... They both are having the same problem, which is that they are displaying duplicate products if I setup both a retail and wholesale (I have two groups set up in SPPC - retail & wholesale) special price. The problem doesn't occur if only one or the other group has a special price setup.

 

My bestseller.php infobox file is modified to show best sellers selected from the admin side, to display product graphic, to scroll and show whatever price is setup (special price, regular price, salemaker price), and has a background graphic. All works fine as long as only one group has a special.

 

My shop_by_price.php infobox file is modified to display a short description, with the product graphic enlarging on click, and a "more info link" to the product_info.php file. Again, all works fine as long as only one group has a special. (By the way I did not have to modify this for it to pick up the SPPC prices, I don't know enough about php to why though.)

 

Neither file displays the same product twice, with the different (retail & wholesale) special prices. Both files display the same product twice (duplicated) with the same price (price depending on how I am logged in - retail or wholesale). Again, only if there is a special price setup for both groups.

 

Sure would appreciate some help with this when and if you have the time.

 

Carlos

 

Below are the three files involved:

 

1) includes/boxes/bestseller.php

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

2) includes/boxes/shop_by_price.php

3) shop_by_price.php

 

includes/boxes/bestseller.php:

 

<?php
// <!-- Best Sellers -->
if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {

$best_sellers_query = tep_db_query("select p.products_id, p.products_image, pd.products_name, p.products_price, p.products_tax_class_id, s.specials_new_products_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_BESTSELLER . " b on p.products_id = b.products_id and p.products_id = pd.products_id where p.products_status = '1' and b.status = '1' order by rand($mtm) DESC limit " . MAX_DISPLAY_BESTSELLER_PRODUCTS);

if (tep_db_num_rows($best_sellers_query) >= MIN_DISPLAY_BESTSELLERS) {

// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

if(!tep_session_is_registered('sppc_customer_group_id')) { 
$customer_group_id = '0';
} else {
 $customer_group_id = $sppc_customer_group_id;
}

while ($_best_sellers = tep_db_fetch_array($best_sellers_query)) {
$best_sellers[] = $_best_sellers;
$list_of_product_ids[] = $_best_sellers['products_id']; // populate array of product id's
} // end while ($_best_sellers = tep_db_fetch_array($best_sellers_query))
$listing_of_prdct_ids = implode(",", $list_of_product_ids);// create comma separated list of product id's

// get all customers_group_prices for products with the particular customer_group_id
// however not necessary for customer_group_id = 0
if ($customer_group_id != '0') {
$pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where products_id in (". $listing_of_prdct_ids .") and pg.customers_group_id = '".$customer_group_id."'");
while ($pg_array = tep_db_fetch_array($pg_query)) {
$new_bestseller_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price']);
}

for ($x = 0; $x < count($best_sellers); $x++) {
// replace products prices with those from customers_group table
if(!empty($new_bestseller_prices)) {
for ($i = 0; $i < count($new_bestseller_prices); $i++) {
if( $best_sellers[$x]['products_id'] == $new_bestseller_prices[$i]['products_id'] ) {
$best_sellers[$x]['products_price'] = $new_bestseller_prices[$i]['products_price'];
 }
}
} // end if(!empty($new_bestseller_prices)
} // end for ($x = 0; $x < count($best_sellers); $x++)
} // end if ($customer_group_id != '0')
?>

<tr>
 <td>
<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td align="center">
<!-- Tab Table -->
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="25">
<tr>
<td width="10" height="25">
<img border="0" src="<?php echo DIR_WS_TEMPLATES . TEMPLATE_NAME;?>/images/design/bg_tab_left.gif" width="10" height="25">
</td>
<td align="center" height="25" background="<?php echo DIR_WS_TEMPLATES . TEMPLATE_NAME;?>/images/design/bg_tab_center.gif" style="background-repeat: no-repeat" width="100%">

<?php
 define('BOX_HEADING_BESTSELLERS', 'Best Sellers');
 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'center', 'text'  => BOX_HEADING_BESTSELLERS);
 new infoBoxHeading($info_box_contents);

$rows = 0;
$bestsellers_list = '<table border="0" width="100%" cellspacing="0" cellpadding="3">';
// while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {
for ($x = 0; $x < count($best_sellers); $x++) { 
// change all $best_sellers['db_field'] to $best_sellers[$x]['db_field']
$best_sellers[$x]['specials_new_products_price'] = tep_get_products_special_price($best_sellers[$x]['products_id']); 
$rows++;

if (tep_not_null($best_sellers[$x]['specials_new_products_price'])) {

$bestsellers_list .= '<tr><td align="center" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0" class="bestSellers"><tr><td align="center" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="3"><tr><td align="center" class="bestSellers"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers[$x]["products_id"], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $best_sellers[$x]['products_image'], $best_sellers[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td></tr><tr><td align="center" class="bestSellers">' .  '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers[$x]['products_id'], 'NONSSL') . '">' . $best_sellers[$x]['products_name'] . '</a></td></tr><tr><td align="center"><table border="0" cellspacing="0" cellpadding="0"><tr><td align="center" valign="bottom" class="bestSellers"><b><s>' . $currencies->display_price($best_sellers[$x]['products_price'], tep_get_tax_rate($best_sellers[$x]['products_tax_class_id'] . '</s></b>')) . '</td></tr><tr><td align="center" valign="top" class="main"><b><span class="productSpecialPrice">' . $currencies->display_price(tep_get_products_special_price($best_sellers[$x]['products_id']), tep_get_tax_rate($best_sellers[$x]['products_tax_class_id'])) . '</b></span></td></tr></table></td></tr></table></td></tr></table></td></tr>';

} else {

$bestsellers_list .= '<tr><td align="center" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0" class="bestSellers"><tr><td align="center" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="3"><tr><td align="center" class="bestSellers"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers[$x]["products_id"], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $best_sellers[$x]['products_image'], $best_sellers[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td></tr><tr><td align="center" class="bestSellers">' .  '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers[$x]['products_id'], 'NONSSL') . '">' . $best_sellers[$x]['products_name'] . '</a></td></tr><tr><td align="center" class="bestSellers"><b>' . $currencies->display_price($best_sellers[$x]['products_price'], tep_get_tax_rate($best_sellers[$x]['products_tax_class_id'])) . '</b></td></tr></table></td></tr></table></td></tr>';

}

}

$bestsellers_list .= '</table>';

echo '	  </td><td width="10" height="25">';
echo '		<img border="0" src="templates/standard/images/design/bg_tab_right.gif" width="10" height="25">';
echo '	  </td></tr></table>';
// <!-- /Tab Table -->
echo '  </td></tr><tr><td align="center">';
echo '<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td align="center">';

 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'center', 'text' => '<table border="0" width="100%" cellspacing="0" cellpadding="0" style="background-color: #000000; background-image: url(\'templates/standard/images/bg_best_sellers.jpg\'); background-repeat: no-repeat; background-position: 75% 100%"><tr><td align="center"><MARQUEE behavior= "scroll" align= "center" direction= "up" height="140" scrollamount= "2" scrolldelay= "70" style="background-image: url(\'templates/standard/images/bg_best_sellers.jpg\'); background-repeat: no-repeat; background-position: 75% 100%"  onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>'. $bestsellers_list .'</MARQUEE></td></tr></table>');
 new infoBox($info_box_contents);

echo '	  </td></tr></table>';
echo '	  </td></tr></table>';

?>
 </td>
</tr>
<?php
 }
}
?>
<!-- /Best Sellers -->

 

includes/boxes/shop_by_price.php:

 

<!-- Shop By Price Box -->
<?php
if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {
?>

<tr>
 <td>
<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td align="center">
<!-- Tab Table -->
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="25">
<tr>
<td width="10" height="25">
<img border="0" src="<?php echo DIR_WS_TEMPLATES . TEMPLATE_NAME;?>/images/design/bg_tab_left.gif" width="10" height="25">
</td>
<td align="center" height="25" background="<?php echo DIR_WS_TEMPLATES . TEMPLATE_NAME;?>/images/design/bg_tab_center.gif" style="background-repeat: no-repeat" width="100%">

<?php
 define('BOX_HEADING_SHOP_BY_PRICE', 'Shop By Price');
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOP_BY_PRICE); 
 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'center', 'text'  => BOX_HEADING_SHOP_BY_PRICE);
 new infoBoxHeading($info_box_contents);

echo '	  </td><td width="10" height="25">';
echo '		<img border="0" src="templates/standard/images/design/bg_tab_right.gif" width="10" height="25">';
echo '	  </td></tr></table>';
// <!-- /Tab Table -->
echo '  </td></tr><tr><td align="center">';
echo '<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td align="center">';

$info_box_contents = array();

for ($range=0; $range<sizeof($price_ranges); $range++) {
	$info_box_contents[] = array('align' => 'left',
							 'text'  => '????????' . '<a href="' . tep_href_link(FILENAME_SHOP_BY_PRICE, 'range=' . $range , 'NONSSL') . '">' . $price_ranges[$range] . '</a><br>' 
							);
}				
new infoBox($info_box_contents);


echo '	  </td></tr></table>';
echo '	  </td></tr></table>';

?>
 </td>
</tr>

<?php
}
?>
<!-- /Shop By Price Box -->

 

shop_by_price.php:

 

<!-- Shop By Price -->
<table border="0" width="100%" cellspacing="0" cellpadding="<?php echo CELLPADDING_SUB; ?>">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td>
<?php

 // create column list
 $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
				   'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
				   'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 
				   'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
				   'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
				   'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
				   'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
				   'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
 asort($define_list);

 $column_list = array();
 reset($define_list);
 while (list($column, $value) = each($define_list)) {
if ($value) $column_list[] = $column;
 }

 $select_column_list = '';

 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
if ( ($column_list[$col] == 'PRODUCT_LIST_BUY_NOW') || ($column_list[$col] == 'PRODUCT_LIST_NAME') || ($column_list[$col] == 'PRODUCT_LIST_PRICE') ) {
  continue;
}
 }
$get_range = ( (isset($_GET['range']) AND 
 isset($price_ranges_sql[$_GET['range']])) ? $_GET['range'] : 0 );

 $listing_sql = "select p.products_id, pd.products_name, p.products_image, p.short_desc, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name, p.manufacturers_id from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_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 p.products_status = '1' and " . $price_ranges_sql[$get_range] . " order by p.products_price asc, pd.products_name";

include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);
?>
	</td>
  </tr>
</table>
<!-- /Shop By Price -->

Share this post


Link to post
Share on other sites

I think you can leave out the left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id in $best_sellers_query (the code uses tep_get_products_special_price to see if there is a special price anyway, that function is customer_group_id aware).

<?php
// <!-- Best Sellers -->
if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {

$best_sellers_query = tep_db_query("select p.products_id, p.products_image, pd.products_name, p.products_price, p.products_tax_class_id, s.specials_new_products_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p  left join " . TABLE_BESTSELLER . " b on p.products_id = b.products_id and p.products_id = pd.products_id where p.products_status = '1' and b.status = '1' order by rand($mtm) DESC limit " . MAX_DISPLAY_BESTSELLER_PRODUCTS);

includes/boxes/shop_by_price.php:
Seems to get its info from shop_by_price.php, so no need to change anything there.

 

shop_by_price.php only needs to avoid selecting specials according to products_id because then you get a double selection when there are two groups with a special price. includes/product_listing.php deals with the group prices I assume, so no need to change anything further then the code to get the customer_group_id and adding the and s.customers_group_id = '" . $customer_group_id . "'.

 if(!tep_session_is_registered('sppc_customer_group_id')) { 
$customer_group_id = '0';
} else {
 $customer_group_id = $sppc_customer_group_id;
}

 $listing_sql = "select p.products_id, pd.products_name, p.products_image, p.short_desc, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name, p.manufacturers_id from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_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 p.products_status = '1' and " . $price_ranges_sql[$get_range] . " and s.customers_group_id = '" . $customer_group_id . "' order by p.products_price asc, pd.products_name";

Share this post


Link to post
Share on other sites

Thank you Jan...

 

The bestsellers now works with your changes & ( with the additional removal of "s.specials_new_products_price" from the query).

 

The shop_by_price now works too, in that with your changes it does not duplicate - however it now only draws from the products that are on special, and does not show the other products.

 

I am wanting to understand, which I don't yet, but I am hoping to - this duplicating problem better. I have several more files that duplicate as well. With your help, I at least now know that it likely to do with the queries.

 

If you have any thoughts on why I am just getting the products on special now, in the shop_by_price - I'd sure appreciate hearing them. Or any thoughts on what might be causing duplicating in any files in general - I'd love to know!

 

I had hoped that it was a universal problem, and that knowing how to solve it with the two files I posted, would help me to understand how to solve it with the rest.

 

Thanks again.

 

Carlos

Share this post


Link to post
Share on other sites
The shop_by_price now works too, in that with your changes it does not duplicate - however it now only draws from the products that are on special, and does not show the other products.
Yes, true, total disaster. This is the reason why those dynamically updated tables were introduced in index.php. I couldn't think of a way to filter the table specials for only those with the correct customer_group_id (long story, never mind).
I am wanting to understand, which I don't yet, but I am hoping to - this duplicating problem better. I have several more files that duplicate as well. With your help, I at least now know that it likely to do with the queries.
The trouble is that in the table specials all specials prices together with the customer group id are stored. So if you do a join with products_id, you get also the ones for other customer groups. If you include the customer group id you don't do a proper left join.

 

To do this, you need to do what was used in index.php, the dynamically updated tables for getting the correct price range. I don't see any other way.

 

I think this should work better:

 

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') {
$listing_sql = "select p.products_id, pd.products_name, p.products_image, p.short_desc, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name, p.manufacturers_id from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id where p.products_status = '1' and " . $price_ranges_sql[$get_range] . " order by p.products_price asc, pd.products_name";
} else {
  $product_prices_table = TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id;

$listing_sql = "select p.products_id, pd.products_name, p.products_image, p.short_desc, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name, p.manufacturers_id from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . $product_prices_table . " s on p.products_id = s.products_id where p.products_status = '1' and " . $price_ranges_sql[$get_range] . " order by p.products_price asc, pd.products_name";
}

Actually, it would be good to also do the checks on existence and last update of those tables (as is done in index.php). However, if the site has been up for a while those tables should be there and probably they don't need to change very often so it should be fine.

 

Anyway, the shopping cart etc. gets the prices from the "real" ones so no harm can be done.

Share this post


Link to post
Share on other sites

Thanks once again Jan...

 

The new code worked afterall. At first, just for retail - for wholesale I got an error, that the TABLE_PRODUCTS_GROUP_PRICES didn't exist, then I tried changing the default minutes from 15 to 1 in the database_tables.php file, same thing, then I tried changing the specials information & the groups price, thinking that's what this instruction meant ("changes in table specials will trigger an immediate update if a query needs this particular table") . Eventually I did have to add:

 

   $product_prices_table = TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id;
  // the table with product prices for a particular customer group is re-built only a number of times per hour
  // (setting in /includes/database_tables.php called MAXIMUM_DELAY_UPDATE_PG_PRICES_TABLE, in minutes)
  // to trigger the update the next function is called (new function that should have been
  // added to includes/functions/database.php)
  tep_db_check_age_products_group_prices_cg_table($customer_group_id);
  $status_product_prices_table = true;

from the indx.php file, which did the trick. Now it works.

 

I wish I could understand better what is going on. Again, I have several more files that have to be addressed with this.

 

I am assuming that it would be better not to have had to use the additional code, because you didn't to begin with. Is this correct? And if so, could you maybe explain a little as to why.

 

Well, now I am going to try and modify what you coded to work for the other files that have duplicating.

 

You really are remarkably generous with your time here. I have been able to solve many problems in other areas by reading your ongoing posts to so many people.

 

Thank you so much.

 

Carlos

Share this post


Link to post
Share on other sites

Any ideas on how to use the Free Shipping above a certain amount settings (via admin) for just the retail group?

Share this post


Link to post
Share on other sites

Carlos,

Any ideas on how to use the Free Shipping above a certain amount settings (via admin) for just the retail group?
There is a piece of code in includes/modules/order_total/ot_shipping.php to which you can add that:

 

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 (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
	switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
	  case 'national':
		if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
	  case 'international':
		if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
	  case 'both':
		$pass = true; break;
	  default:
		$pass = false; break;
	}

	if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)  && $customer_group_id == '0' ) {
	  $order->info['shipping_method'] = $this->title;
	  $order->info['total'] -= $order->info['shipping_cost'];
	  $order->info['shipping_cost'] = 0;
	}
  }

Share this post


Link to post
Share on other sites

Thanks Again Jan!

 

I have had a time of it installing SPPC - ONLY because of the sooo.. many modified contributions I already had!

 

I simply could not have done it without your help. This last time, just for information, the code you sent me, put me on the right track to having, it seems anyway, exactly what I wanted.

 

Again, just for information:

 

For me, to be able to use the Free Shipping above a certain amount settings (via admin) for just the retail group, I have had to modify 4 files:

 

1) checkout_shipping.php

(already previously mofified from its original code)

2) includes/boxes/shopping_cart.php

(already previously modified using several other contributions)

3) includes/modules/order_total/ot_shipping.php

4) includes/modules/shipping_estimator.php

(contribution that was already previously modified from its original code)

 

In:

includes/boxes/shopping_cart.php &

includes/modules/order_total/ot_shipping.php

I replaced:

 

if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {

 

With:

 

// <!-- SPPC --> Original Code: if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
  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 ((MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') && ($customer_group_id == '0')) {
// <!-- /SPPC -->

 

In:

checkout_shipping.php &

includes/modules/shipping_estimator.php

I replaced:

 

if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true')) {

 

With:

 

// <!-- SPPC --> Original Code: if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true')) {
  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 ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') && ($customer_group_id == '0') ) {
// <!-- /SPPC -->

 

Now on to Part 2... Quantity Price Breaks for Separate Pricing Per Customer!

 

Carlos

 

P.S. I am now announcing officially to the world at large and to the osc community in particular that: "I am a Jan fan!"

Share this post


Link to post
Share on other sites

I have integrated Hide products from customer groups for SPPC into the cart with great success.. I also am working with EZ Populate which is a life saver!! Is there someway to get the hide column into the ezpopulate?? There are just over 3000 items in the cart and 40-60% will need to be hidden from the retail people.

 

I see the "products_hide_from_groups" data is in the products table in the DB.. I see the non-hidden products are marked "@" in the field.. I also see the hidden products are marked "@,0"

 

I do not need to hide products at all from the other groups.. just the retail..

 

So how can I add this to the EZ populate so these particular times do not have to be hidden one by one individually, but rather do it en mass with ez populate..

 

I suppose I can ezpopulate then export the product table, alter it locally, empty the table, then import the altered?? That would work also but it would be extra work rather than having this done within ez populate inthe first place!

 

thanks!


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

Share this post


Link to post
Share on other sites
I have integrated Hide products from customer groups for SPPC into the cart with great success.. I also am working with EZ Populate which is a life saver!! Is there someway to get the hide column into the ezpopulate?? There are just over 3000 items in the cart and 40-60% will need to be hidden from the retail people.

 

I see the "products_hide_from_groups" data is in the products table in the DB.. I see the non-hidden products are marked "@" in the field.. I also see the hidden products are marked "@,0"

 

I do not need to hide products at all from the other groups.. just the retail..

 

So how can I add this to the EZ populate so these particular times do not have to be hidden one by one individually, but rather do it en mass with ez populate..

 

I suppose I can ezpopulate then export the product table, alter it locally, empty the table, then import the altered?? That would work also but it would be extra work rather than having this done within ez populate inthe first place!

 

thanks!

 

Has anyone found a way to hide entire product groups from customer groups without editing the individual product information?


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.

Share this post


Link to post
Share on other sites

Hi,

 

I've just finished setting up OSC, SPPC is the only contribution I've installed. Upon test, customers assigned to a Customer Group works perfectly.

However customers who join in the default (retail) group have errors:

 

 

Warning: reset(): Passed variable is not an array or object in /home/share/public_html/shop/includes/classes/shipping.php on line 54

 

Warning: Variable passed to each() is not an array or object in /home/share/public_html/shop/includes/classes/shipping.php on line 55

 

Warning: reset(): Passed variable is not an array or object in /home/share/public_html/shop/includes/classes/payment.php on line 56

 

Warning: Variable passed to each() is not an array or object in /home/share/public_html/shop/includes/classes/payment.php on line 57

 

It is not calculating the shipping (table rate) and payment method (check/money order or PayPal).

 

I would be extremely grateful for any assistance.

 

Kate

Share this post


Link to post
Share on other sites

Could this be a solution to something I have tried to figure out and failed I wonder!??

 

Basically i did not wish to have the prices worked out based on the exchange rate. Instead I wanted to have individual prices per country, something known as 'market based pricing'.

 

Well anyhoots, has anyone tried to mod this contribution so when someone signed up it would auto assign people to a group based on the country they select?

 

My thoughts are this would them allow me to have seperate pricing per country!?

 

Any thoughts?

Share this post


Link to post
Share on other sites

Kate,

I've just finished setting up OSC, SPPC is the only contribution I've installed. Upon test, customers assigned to a Customer Group works perfectly.

However customers who join in the default (retail) group have errors:

Warning: reset(): Passed variable is not an array or object in /home/share/public_html/shop/includes/classes/shipping.php on line 54

Strange error. It seems to be the line "reset($this->modules);" which should be an array.

 

This particular error is mostly encountered in object_info.php (line 17 and 18 I think) and I saw a reference to a fix for that in this post.

 

Can you at least apply the fix (mentioned as the last one in this post) in create_account.php? Perhaps that helps.

Edited by JanZ

Share this post


Link to post
Share on other sites

Debbie,

I see the "products_hide_from_groups" data is in the products table in the DB.. I see the non-hidden products are marked "@" in the field.. I also see the hidden products are marked "@,0"
Yes, that is the right syntax for hiding from retail.
So how can I add this to the EZ populate so these particular times do not have to be hidden one by one individually, but rather do it en mass with ez populate..
I don't have a clue. I'm sure you should be able to alter EZ populate for such an additional field, but I have never used or downloaded that contribution so either search for it in the EZ populate thread or ask it there if you don't get a better answer soon.

Share this post


Link to post
Share on other sites
Well anyhoots, has anyone tried to mod this contribution so when someone signed up it would auto assign people to a group based on the country they select?

 

My thoughts are this would them allow me to have seperate pricing per country!?

 

Any thoughts?

Does sound you are on to something. I assume it wouldn't be too much work to assign a customer to a country on the basis of his address when he registers. However, on first glance I don't see how you can tie a specific currency to a specific customer/customer group. Well, a lot of things are possible in osCommerce so perhaps... why not?

 

Visitors from the "other" country who are not logged-in will still see your prices in the other currency of course (unless they have to login before seeing any).

Share this post


Link to post
Share on other sites
However, on first glance I don't see how you can tie a specific currency to a specific customer/customer group. Well, a lot of things are possible in osCommerce so perhaps... why not?

 

 

Hmmm - I see what you mean.

 

The adding user to a price group based on their country I do not believe would be too hard. Probably quite easy, although I have not downloaded the code and looked over it.

 

The very hard part would then be assigning a single currency to the 'country group'.

 

I will have to look at the code. I thought this was going to be my saviour! :(

 

Still anyone know of a contrib that does seperate pricing and not use the exchange rate?

Share this post


Link to post
Share on other sites

in regards to the minimum order amount mod for SPPC.....

Bob,

Yes.

You would have to make that "customer group aware" then. There were two people who had a question about that recently. See this post for a suggestion.

 

so im summary, I just need to add the following code to these files: checkout_confirmation.php, checkout_payment.php, checkout_shipping.php, checkout_process.php AND shopping_cart.php(alittle different then the other files as far as the code being modified).

 

&& $_SESSION['sppc_customer_group_id'] != '0'

making the complete section of code:

[/code]

if ($order->info['subtotal'] < MIN_ORDER_AMOUNT && $_SESSION['sppc_customer_group_id'] != '0') {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'));

 

And this is would effect all groups other then "0", which should be retail. Correct?

 

Thanks a ton Jan.

Edited by Sid04

Share this post


Link to post
Share on other sites

The above changes SEEMED to have worked except for one small issue. If the customer isnt logged in, it still displays the minimum order amount notice in the shopping cart ALTHOUGH it still allows the customer to checkout. Im not sure why it lets them checkout and at the same time giving them the minimum checkout amount message.

 

Is there a way to say to bypass the minimal amount contrib IF your not logged in or are logged in under RETAIL? Im going to add the pay without account contrib soon....so I dont want it displaying the notice to people not logged in(or without accounts).

 

I know I could use the "== 1", but I was hoping to leave things setup so that if i added another group down the road I wouldnt have to go back and modify all these files to add the minimal pricing mod to the new groups. Any ideas?

Share this post


Link to post
Share on other sites
Kate,

 

Strange error. It seems to be the line "reset($this->modules);" which should be an array.

 

This particular error is mostly encountered in object_info.php (line 17 and 18 I think) and I saw a reference to a fix for that in this post.

 

Can you at least apply the fix (mentioned as the last one in this post) in create_account.php? Perhaps that helps.

 

 

JanZ

 

I have applied both of the suggested fixes, neither make any difference. I still get the shipping and payment errors and it doesn't calculate the shipping or allow payment by either method (check/money order or PayPal). I'm completely stuck here, I'm afraid I'm a complete OSC newbie which probably doesn't help as I've no idea where to even start looking for problems.

 

I'd be extremely grateful for further help.

 

Many thanks

Kate

Share this post


Link to post
Share on other sites

Bob,

The above changes SEEMED to have worked except for one small issue. If the customer isnt logged in, it still displays the minimum order amount notice in the shopping cart ALTHOUGH it still allows the customer to checkout. Im not sure why it lets them checkout and at the same time giving them the minimum checkout amount message.

 

Is there a way to say to bypass the minimal amount contrib IF your not logged in or are logged in under RETAIL? Im going to add the pay without account contrib soon....so I dont want it displaying the notice to people not logged in(or without accounts).

OK... when you are able to get to these pages without being logged-in the SESSION variable with the customer group will not be set. Either use the code you see on some many pages
	 global $sppc_customer_group_id, $customer_id;
 if(!tep_session_is_registered('sppc_customer_group_id')) { 
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }

and use $customer_group_id instead of $_SESSION['sppc_customer_group_id']

OR change it to take that into account too:

if (($order->info['subtotal'] < MIN_ORDER_AMOUNT) && (isset($_SESSION['sppc_customer_group_id']) &&$_SESSION['sppc_customer_group_id'] != '0') ) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'));

 

Kate,

I have applied both of the suggested fixes, neither make any difference. I still get the shipping and payment errors and it doesn't calculate the shipping or allow payment by either method (check/money order or PayPal). I'm completely stuck here, I'm afraid I'm a complete OSC newbie which probably doesn't help as I've no idea where to even start looking for problems.
I have no suggestion yet to what to check first. However, if you don't use any special shipping or payment options for a customer group, just reverse the changes made for SPPC to those shipping and payment pages. Then you would have your "old" pages back and if the error is indeed due to SPPC (which I guess it does) then at least your website continues working.

Share this post


Link to post
Share on other sites
Bob,

OK... when you are able to get to these pages without being logged-in the SESSION variable with the customer group will not be set. Either use the code you see on some many pages

	 global $sppc_customer_group_id, $customer_id;
 if(!tep_session_is_registered('sppc_customer_group_id')) { 
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }

and use $customer_group_id instead of $_SESSION['sppc_customer_group_id']

OR change it to take that into account too:

if (($order->info['subtotal'] < MIN_ORDER_AMOUNT) && (isset($_SESSION['sppc_customer_group_id']) &&$_SESSION['sppc_customer_group_id'] != '0') ) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'));

im curious.....why does the '== 1' method work when not logged in? Thanks

Share this post


Link to post
Share on other sites
Bob,

OK... when you are able to get to these pages without being logged-in the SESSION variable with the customer group will not be set. Either use the code you see on some many pages

	 global $sppc_customer_group_id, $customer_id;
 if(!tep_session_is_registered('sppc_customer_group_id')) { 
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }

and use $customer_group_id instead of $_SESSION['sppc_customer_group_id']

OR change it to take that into account too:

if (($order->info['subtotal'] < MIN_ORDER_AMOUNT) && (isset($_SESSION['sppc_customer_group_id']) &&$_SESSION['sppc_customer_group_id'] != '0') ) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'));

 

Kate,

I have no suggestion yet to what to check first. However, if you don't use any special shipping or payment options for a customer group, just reverse the changes made for SPPC to those shipping and payment pages. Then you would have your "old" pages back and if the error is indeed due to SPPC (which I guess it does) then at least your website continues working.

 

JanZ

 

Many thanks for the help, have restored the shipping and payment pages and it works fine now. I assume as long as the retail customers and the group customers always have the same shipping and payment charges/options this will always work.

 

One quick matter if you've a moment. Could you recommend a shipping module that works OK with SPPC. My shipping is simple up to ?x shipping is ?y over ?y shipping is free. I need to set this up for three zones, UK, Europe, Rest of the World and at each zone ?y is a different value. The catalogue of shipping modules/contributions is vast, hence asking for a recommendation for one that works OK with SPPC; I'm terrified of causing errors.

 

Many many thanks

Kate

Share this post


Link to post
Share on other sites

Kate,

have restored the shipping and payment pages and it works fine now. I assume as long as the retail customers and the group customers always have the same shipping and payment charges/options this will always work.
Yes, but I still don't understand why you get these errors. Did you use the files that came with the contribution or did you make the changes manually?
Could you recommend a shipping module that works OK with SPPC. My shipping is simple up to ?x shipping is ?y over ?y shipping is free. I need to set this up for three zones, UK, Europe, Rest of the World and at each zone ?y is a different value.
I think you would be best off with "table rate" that is a standard method in the admin section. For the three different zones I think you can best add two different table rate. Terry K gave tips about how to do that in the Tips and Tricks section of the forum.

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

×