Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

I am looking to have the prices for Products Attributes to be separate for pricing group as well.

 

Can i set different prices for the attributes?

If that is to hard could i have a product that only retail price will see. with its attributes. Then if logged on as wholesale they don't see that product but another product with different prices attributes.

 

Thanks for any help.

I have been using SPPC for awhile now and love it.

Share this post


Link to post
Share on other sites
Also added/removed special pricing and sorted by price (no refresh) under both the wholesale and retail logins - seems the correct price gets updated upon sort.
That is correct because the price is queried separately in product_listing.php. The sort order might get wrong.
By no means challenging your judgement, just want to make sure I understand the risks involved. Of course, correct pricing is way more important than a few seconds load time, but if I can have my cake and eat it too...
I will take another look at it the next days. Perhaps it can be done more efficient.

 

By the way, the SPPC install is on my local dev environment, with only 5 test products. Thinking the code probably just isn't jiving with one of the other contributions installed [and there are many].
Weird, I did use Chemo's contribution for echo'ing all the queries and the time they take and I never noticed anything out of the ordinary with the sample set of products that come with osC MS2.2.

Share this post


Link to post
Share on other sites
I am looking to have the prices for Products Attributes to be separate for pricing group as well.

 

Can i set different prices for the attributes?

Not with SPPC as it can be found in the contribution section. The new code for that is ready though. I can send it to your email address if you like (PM me). I will put it in a new version of SPPC (promises, promises, promises).
If that is to hard could i have a product that only retail price will see. with its attributes. Then if logged on as wholesale they don't see that product but another product with different prices attributes.
That is an option but your stock will be out of whack that way.

Share this post


Link to post
Share on other sites
Hi,

 

I use Easy Populate woith SPPC, it's work very well, you have to do some change in Easy Populate. Do the following :

<snip>

Good luck... :thumbsup:

 

hmm,thanks for your help, but no dice...don't worry, I'm very sure I'm doingsomething wrong with EP, will just have to startfresh with it.....

 

Also was messing with the MySQL, but there's probably a few instances of where I need to change the pricing, am I right?

Share this post


Link to post
Share on other sites
Hi,

 

I use Easy Populate woith SPPC, it's work very well, you have to do some change in Easy Populate. Do the following :

Good luck... :thumbsup:

 

 

Actually Jeep, thanks! I could never get EP to export the extra price column, so I added it manually and then imported it! it worked!

Share this post


Link to post
Share on other sites

Hello Janz, I feel it by my English who am very bad, but to like I please if me you can solve questions. This sppc updated to be able to work with the version osCommerce 2,2 Milestone 2 Update 060817? I ask it so that it tries to fit it and I could not do it to my store so that the code differs in several parts. In my attempt to install sppc it prepares a manual I have I made the modifications in the virgin archives of oscommerce and aims where habia had problems and what fuy able not to do. Perhaps if somebody of experience reviewed podria to it to be worth so that usuary like I just initiated in oscommerce to be able to enjoy this great contribution. Also to like to ask if you have thought I, since you are one of the active assistants but, to remove a new version from sppc, and if she is thus for when serious more or less.

 

Thanks for your answers and a pleasure.

Moan my badly English.

A greeting

 

Pd: Here I leave the direction with which it can make, the made changes and the problems that tube and where.

http://www.megaupload.com/es/?d=V6QY0XEP

Share this post


Link to post
Share on other sites

Hi JanZ,

 

I am in need of some knowledge :D

 

I have SPPC v4.1.5 installed and I am using the Table Based Shipping Rate (standard) as well as the Free Shipping w/Minimum Amount contrib. I need to know how to change the minimum amount for wholesale vs retail. Right now, retail customers receive free shipping on orders over $150 and wholesale customers receive free shipping on orders over $200. I'm not sure how to make it do this. The below code is the Free Shipping w/Minimum Amounts contrib so hopefully you can see what I need to change and where ;)

 

includes/languages/english/modules/shipping/freeamount.php

define('MODULE_SHIPPING_FREEAMOUNT_TEXT_UNIT', ' lbs ');
define('MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE', 'Free Shipping');
define('MODULE_SHIPPING_FREEAMOUNT_TEXT_DESCRIPTION', 'Free Shipping w/ Minimum Order Amount');
define('MODULE_SHIPPING_FREEAMOUNT_TEXT_WAY', 'For orders of $' . MODULE_SHIPPING_FREEAMOUNT_AMOUNT . ' or more with a maximum package weight of '  . MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX . ' ' . MODULE_SHIPPING_FREEAMOUNT_TEXT_UNIT);
define('MODULE_SHIPPING_FREEAMOUNT_TEXT_ERROR', 'Free shipping only for an order of $' . MODULE_SHIPPING_FREEAMOUNT_AMOUNT . ' or more with a maximum package weight of '  . MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX . ' ' . MODULE_SHIPPING_FREEAMOUNT_TEXT_UNIT);
define('MODULE_SHIPPING_FREEAMOUNT_TEXT_TO_HEIGHT', 'Free shipping only for an order of $' . MODULE_SHIPPING_FREEAMOUNT_AMOUNT . ' or more with a maximum package weight of '  . MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX . ' ' . MODULE_SHIPPING_FREEAMOUNT_TEXT_UNIT);
define('MODULE_SHIPPING_FREEAMOUNT_COST', '0.00');

 

includes/modules/shipping/freeamount.php

class freeamount {
var $code, $title, $description, $icon, $enabled;

// class constructor
function freeamount() {
  global $order, $customer;

  $this->code = 'freeamount';
  $this->title = MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_FREEAMOUNT_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER;
  $this->icon ='';
  $this->enabled = ((MODULE_SHIPPING_FREEAMOUNT_STATUS == 'True') ? true : false);

  if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEAMOUNT_ZONE > 0) ) {

	$check_flag = false;
	$check_query = tep_db_query("select zone_id, zone_country_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FREEAMOUNT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
	$order_shipping_country = $order->delivery['country']['id'];

	while ($check = tep_db_fetch_array($check_query)) {

	  if ($check['zone_id'] < 1) {
		$check_flag = true;
		break;
//		  } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
	  } elseif ($check['zone_country_id'] == $order->delivery['country']['id']) {
		$check_flag = true;
		break;
	  }
	}
	if ($check_flag == false) {
	  $this->enabled = false;
	}
 }
}

// class methods
function quote($method = '') {
  global $order, $cart, $shipping_weight;

  $dest_country = $order->delivery['country']['id'];
  $currency = $order->info['currency'];
  $get_total = false;
  $get_weight = false;
  $cart_total = $cart->show_total();

	if (MODULE_SHIPPING_FREEAMOUNT_HIDE_SPECIALS == 'True') {
	  // 28-9-2005 Check for articles on special which should not get free shipment
	  // Adjust the cart total price for this
	  $total_specials = 0;
	  if ($cart->count_contents() > 0) {
		 $products = $cart->get_products();
		 for ($i=0, $n=sizeof($products); $i<$n; $i++) {
			if ($special_price = tep_get_products_special_price($products[$i]['id'])) {
			   $products_price = $special_price;
			   $total_specials += $products_price;
			}
		 }
	  }

	  $cart_total = $cart_total - $total_specials;
	}

  if ($cart_total < MODULE_SHIPPING_FREEAMOUNT_AMOUNT)
  {
	if (MODULE_SHIPPING_FREEAMOUNT_DISPLAY == 'True')
	   {
		$this->quotes['error'] = MODULE_SHIPPING_FREEAMOUNT_TEXT_ERROR;
	   }
	$get_total = false;
   } else {
	$get_total = true;
   }

  if ($shipping_weight > MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX)
	  {
		if (MODULE_SHIPPING_FREEAMOUNT_DISPLAY == 'True')
		   {
			  $this->quotes['error'] = MODULE_SHIPPING_FREEAMOUNT_TEXT_TO_HEIGHT;
		   }
		$get_weight = false;
  } else {
   $get_weight = true;
  }

if (($get_total == true && $get_weight == true))
{
	$this->quotes = array('id' => $this->code,
							'module' => MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE,
							'methods' => array(array('id' => $this->code,
							'title' => MODULE_SHIPPING_FREEAMOUNT_TEXT_WAY,
							'cost' => MODULE_SHIPPING_FREEAMOUNT_COST)));
}


  if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);

  return $this->quotes;

}

function check() {
  if (!isset($this->_check)) {
	$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FREEAMOUNT_STATUS'");
	$this->_check = tep_db_num_rows($check_query);
  }
  return $this->_check;
}

function install() {
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Free Shipping with Minimum Purchase', 'MODULE_SHIPPING_FREEAMOUNT_STATUS', 'True', 'Do you want to offer minimum order free shipping?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id,  sort_order, date_added) values ('Maximum Weight', 'MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX', '10', 'What is the maximum weight you will ship?', '6', '8', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Display', 'MODULE_SHIPPING_FREEAMOUNT_DISPLAY', 'True', 'Do you want to display text way if the minimum amount is not reached?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id,  sort_order, date_added) values ('Minimum Cost', 'MODULE_SHIPPING_FREEAMOUNT_AMOUNT', '50.00', 'Minimum order amount purchased before shipping is free?', '6', '8', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id,  sort_order, set_function, date_added) values ('Disable for Specials', 'MODULE_SHIPPING_FREEAMOUNT_HIDE_SPECIALS', 'True', 'Do you want to disable free shipping for products on special?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_FREEAMOUNT_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
  }

function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

  function keys() {
 $keys = array(
	   'MODULE_SHIPPING_FREEAMOUNT_STATUS',
	   'MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX',
	   'MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER',
	   'MODULE_SHIPPING_FREEAMOUNT_DISPLAY',
	   'MODULE_SHIPPING_FREEAMOUNT_HIDE_SPECIALS',
	   'MODULE_SHIPPING_FREEAMOUNT_AMOUNT',
	   'MODULE_SHIPPING_FREEAMOUNT_ZONE'
	   );
 return $keys;
  }
}

 

Thank you for your assistance :thumbsup:


~Tracy
 

Share this post


Link to post
Share on other sites

Ok - another question for ya ;)

 

I just created a test account as someone from Canada in my store - and when I went to place an order I got a screen asking me to choose if I was retail or wholesale :o

 

We don't want the customers to choose - we need to manually set up wholesalers as wholesalers and not let them choose themselves. How do I disable this?


~Tracy
 

Share this post


Link to post
Share on other sites
Ok - another question for ya ;)

 

I just created a test account as someone from Canada in my store - and when I went to place an order I got a screen asking me to choose if I was retail or wholesale :o

 

We don't want the customers to choose - we need to manually set up wholesalers as wholesalers and not let them choose themselves. How do I disable this?

 

I am not sure about your question, but that sounds odd & mine doesn't work that way. As it is right now I create almost all the accounts & the only one that has a choice like that is my (admin) login. But you may have a different OS version or contributions than I.


Kristine

Share this post


Link to post
Share on other sites
I am not sure about your question, but that sounds odd & mine doesn't work that way. As it is right now I create almost all the accounts & the only one that has a choice like that is my (admin) login. But you may have a different OS version or contributions than I.

 

It only happens on the Canada account I setup - when you enter your username and password and click on "login" - it then takes you to a screen to choose retail or wholesale - every single time I log in! I checked in the database and the fake Canada customer does have the number for Retail assigned to them there - so I am at a complete loss.

 

My list of contrib's is in my sig - I'm running osCommerce v2.2 MS2 060817


~Tracy
 

Share this post


Link to post
Share on other sites
It only happens on the Canada account I setup - when you enter your username and password and click on "login" - it then takes you to a screen to choose retail or wholesale - every single time I log in! I checked in the database and the fake Canada customer does have the number for Retail assigned to them there - so I am at a complete loss.

 

My list of contrib's is in my sig - I'm running osCommerce v2.2 MS2 060817

 

PS - I just recently installed these contrib's and am still working on getting them working right:

Free Shipping w/Minimum Amount

Amount till Free Shipping

Zones World and Zones International (currently disabled)

State Based Rates (currently disabled)

 

I'm trying to figure out how to get our shipping set up the way it needs to be - so I'm playing around with different contrib's to find out if one or two will work to get me where I need to be ;)


~Tracy
 

Share this post


Link to post
Share on other sites
PS - I just recently installed these contrib's and am still working on getting them working right:

Free Shipping w/Minimum Amount

Amount till Free Shipping

Zones World and Zones International (currently disabled)

State Based Rates (currently disabled)

 

I'm trying to figure out how to get our shipping set up the way it needs to be - so I'm playing around with different contrib's to find out if one or two will work to get me where I need to be ;)

 

Hi,

 

Your problem for the customer who have the choice to choose retail or wholesale sounds that it's a admin account you have set in /catalog/includes/languages/english/login.php like this :

 

// BOF Separate Pricing Per Customer

// define the email address that can change customer_group_id on login

define('SPPC_TOGGLE_LOGIN_PASSWORD', 'yourname@yourdomain.com');

// EOF Separate Pricing Per Customer

 

Check this out to be sure ..... :thumbsup:


John

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

osCommerce 2.3.4 Bootstrap Edge

Share this post


Link to post
Share on other sites

Hi All!

I'd like to spice up my shop a bit by dropping the Customers Groups Name here and there in the catalog.

You can't see what customer group you belong to anywhere in the catalog...

Is there any way to do this?

//Micke

Share this post


Link to post
Share on other sites

Hi All!

Another feature that might be useful within the concept of SPPC would be a "Customer Group Information page".

Like this:

Let's say that you log in and that you belong to a customer group other than "Retail".

In the Information box there now is a link "Wholesale customer" for instance.

You click the link and you get to a information page with some general information about your specific assortment, agreement and pricelist. (A field with that information will have to be added to the customer_groups table of course)

Wouldn't that be something for all you talented coders...

//Micke

Share this post


Link to post
Share on other sites

Hi All! [JanZ]

I have spent all sunday evening trying to install the "SPPC attributes mod".

Still there are a couple of obstacles in my way to success...

 

Here's the first one:

There's no "Save" button in my SPPC attributes pop-up.

I found this on lines 207 through 210 in attributes_groups.php:

} // end if (isset($attribute_no))
 else {
echo '<div align="center" style="margin-top: 50px;">' . "\n" . '<form name="close">' . "\n" . tep_image_button('button_cancel.gif', IMAGE_CLOSE, 'onclick=\'self.close()\'') .'</form>' . "\n" . '</div>' . "\n";
}

.. that assumes that there is some kind of condition not met for me to get the Save button...

 

What am I doing wrong?

 

//Micke

Share this post


Link to post
Share on other sites
There's no "Save" button in my SPPC attributes pop-up.

I found this on lines 207 through 210 in attributes_groups.php:

} // end if (isset($attribute_no))
 else {
echo '<div align="center" style="margin-top: 50px;">' . "\n" . '<form name="close">' . "\n" . tep_image_button('button_cancel.gif', IMAGE_CLOSE, 'onclick=\'self.close()\'') .'</form>' . "\n" . '</div>' . "\n";
}

.. that assumes that there is some kind of condition not met for me to get the Save button...

 

What am I doing wrong?

Hard to say, but at least the page in the pop-up window is not called with an attribute_id like attributes_groups.php?attributes_id=122. Because the save button is only shown when that is present (no point saving anything when there is nothing meaningfull to save is it):

<?php echo '<p style="margin-top: 20px;"' . tep_image_submit('button_save.gif', IMAGE_SAVE, 'name="submitbutton"') . '?' . tep_image_button('button_cancel.gif', IMAGE_CANCEL, 'onclick=\'self.close()\'') .'</p>' . "\n";
?>
</form>
</div>
<?php
} // end if (isset($attribute_no))
 else {
echo '<div align="center" style="margin-top: 50px;">' . "\n" . '<form name="close">' . "\n" . tep_image_button('button_cancel.gif', IMAGE_CLOSE, 'onclick=\'self.close()\'') .'</form>' . "\n" . '</div>' . "\n";
}
?>
</body>

Check the HTML of the products_attributes.php page to check that link.

Share this post


Link to post
Share on other sites
Hi,

 

Your problem for the customer who have the choice to choose retail or wholesale sounds that it's a admin account you have set in /catalog/includes/languages/english/login.php like this :

 

// BOF Separate Pricing Per Customer

// define the email address that can change customer_group_id on login

define('SPPC_TOGGLE_LOGIN_PASSWORD', 'yourname@yourdomain.com');

// EOF Separate Pricing Per Customer

 

Check this out to be sure ..... :thumbsup:

 

Ah Hah!! You are right!! I didn't even think of that when creating the test account for International - LOL Thank you sooooo much as I have been so confused over this - LOL Glad it's something soo simple :thumbsup:


~Tracy
 

Share this post


Link to post
Share on other sites
I am in need of some knowledge :D

 

I have SPPC v4.1.5 installed and I am using the Table Based Shipping Rate (standard) as well as the Free Shipping w/Minimum Amount contrib. I need to know how to change the minimum amount for wholesale vs retail. Right now, retail customers receive free shipping on orders over $150 and wholesale customers receive free shipping on orders over $200. I'm not sure how to make it do this. The below code is the Free Shipping w/Minimum Amounts contrib so hopefully you can see what I need to change and where ;)

I suggest something along these lines to keep things simple (you could make two different modules and enable/disable them in admin, that is not so simple). I haven't tried this, so backup etc.

 

includes/languages/english/modules/shipping/freeamount.php

	  if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] == '1') {
  $free_amount = MODULE_SHIPPING_FREEAMOUNT_AMOUNT1; 
  } else {
  $free_amount = MODULE_SHIPPING_FREEAMOUNT_AMOUNT;
  }
define('MODULE_SHIPPING_FREEAMOUNT_TEXT_UNIT', ' lbs ');
define('MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE', 'Free Shipping');
define('MODULE_SHIPPING_FREEAMOUNT_TEXT_DESCRIPTION', 'Free Shipping w/ Minimum Order Amount');
define('MODULE_SHIPPING_FREEAMOUNT_TEXT_WAY', 'For orders of $' . $free_amount . ' or more with a maximum package weight of '  . MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX . ' ' . MODULE_SHIPPING_FREEAMOUNT_TEXT_UNIT);
define('MODULE_SHIPPING_FREEAMOUNT_TEXT_ERROR', 'Free shipping only for an order of $' . $free_amount . ' or more with a maximum package weight of '  . MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX . ' ' . MODULE_SHIPPING_FREEAMOUNT_TEXT_UNIT);
define('MODULE_SHIPPING_FREEAMOUNT_TEXT_TO_HEIGHT', 'Free shipping only for an order of $' . $free_amount . ' or more with a maximum package weight of '  . MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX . ' ' . MODULE_SHIPPING_FREEAMOUNT_TEXT_UNIT);
define('MODULE_SHIPPING_FREEAMOUNT_COST', '0.00');

 

includes/modules/shipping/freeamount.php

class freeamount {
var $code, $title, $description, $icon, $enabled;

// class constructor
function freeamount() {
  global $order, $customer;

  $this->code = 'freeamount';
  $this->title = MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_FREEAMOUNT_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER;
  $this->icon ='';
  $this->enabled = ((MODULE_SHIPPING_FREEAMOUNT_STATUS == 'True') ? true : false);
  if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] == '1') {
  $this->free_amount = MODULE_SHIPPING_FREEAMOUNT_AMOUNT1; 
  } else {
  $this->free_amount = MODULE_SHIPPING_FREEAMOUNT_AMOUNT;
  }

  if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEAMOUNT_ZONE > 0) ) {

	$check_flag = false;
	$check_query = tep_db_query("select zone_id, zone_country_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FREEAMOUNT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
	$order_shipping_country = $order->delivery['country']['id'];

	while ($check = tep_db_fetch_array($check_query)) {

	  if ($check['zone_id'] < 1) {
		$check_flag = true;
		break;
//		  } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
	  } elseif ($check['zone_country_id'] == $order->delivery['country']['id']) {
		$check_flag = true;
		break;
	  }
	}
	if ($check_flag == false) {
	  $this->enabled = false;
	}
 }
}

// class methods
function quote($method = '') {
  global $order, $cart, $shipping_weight;

  $dest_country = $order->delivery['country']['id'];
  $currency = $order->info['currency'];
  $get_total = false;
  $get_weight = false;
  $cart_total = $cart->show_total();

	if (MODULE_SHIPPING_FREEAMOUNT_HIDE_SPECIALS == 'True') {
	  // 28-9-2005 Check for articles on special which should not get free shipment
	  // Adjust the cart total price for this
	  $total_specials = 0;
	  if ($cart->count_contents() > 0) {
		 $products = $cart->get_products();
		 for ($i=0, $n=sizeof($products); $i<$n; $i++) {
			if ($special_price = tep_get_products_special_price($products[$i]['id'])) {
			   $products_price = $special_price;
			   $total_specials += $products_price;
			}
		 }
	  }

	  $cart_total = $cart_total - $total_specials;
	}

  if ($cart_total < $this->free_amount)
  {
	if (MODULE_SHIPPING_FREEAMOUNT_DISPLAY == 'True')
	   {
		$this->quotes['error'] = MODULE_SHIPPING_FREEAMOUNT_TEXT_ERROR;
	   }
	$get_total = false;
   } else {
	$get_total = true;
   }

  if ($shipping_weight > MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX)
	  {
		if (MODULE_SHIPPING_FREEAMOUNT_DISPLAY == 'True')
		   {
			  $this->quotes['error'] = MODULE_SHIPPING_FREEAMOUNT_TEXT_TO_HEIGHT;
		   }
		$get_weight = false;
  } else {
   $get_weight = true;
  }

if (($get_total == true && $get_weight == true))
{
	$this->quotes = array('id' => $this->code,
							'module' => MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE,
							'methods' => array(array('id' => $this->code,
							'title' => MODULE_SHIPPING_FREEAMOUNT_TEXT_WAY,
							'cost' => MODULE_SHIPPING_FREEAMOUNT_COST)));
}


  if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);

  return $this->quotes;

}

function check() {
  if (!isset($this->_check)) {
	$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FREEAMOUNT_STATUS'");
	$this->_check = tep_db_num_rows($check_query);
  }
  return $this->_check;
}

function install() {
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Free Shipping with Minimum Purchase', 'MODULE_SHIPPING_FREEAMOUNT_STATUS', 'True', 'Do you want to offer minimum order free shipping?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id,  sort_order, date_added) values ('Maximum Weight', 'MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX', '10', 'What is the maximum weight you will ship?', '6', '8', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Display', 'MODULE_SHIPPING_FREEAMOUNT_DISPLAY', 'True', 'Do you want to display text way if the minimum amount is not reached?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id,  sort_order, date_added) values ('Minimum Cost', 'MODULE_SHIPPING_FREEAMOUNT_AMOUNT', '50.00', 'Minimum order amount purchased before shipping is free?', '6', '8', now())");
  // wholesale for SPPC
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id,  sort_order, date_added) values ('Minimum Cost Wholesale', 'MODULE_SHIPPING_FREEAMOUNT_AMOUNT1', '200.00', 'Minimum order amount for wholesale customers before shipping is free?', '6', '8', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id,  sort_order, set_function, date_added) values ('Disable for Specials', 'MODULE_SHIPPING_FREEAMOUNT_HIDE_SPECIALS', 'True', 'Do you want to disable free shipping for products on special?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_FREEAMOUNT_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
  }

function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

  function keys() {
 $keys = array(
	   'MODULE_SHIPPING_FREEAMOUNT_STATUS',
	   'MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX',
	   'MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER',
	   'MODULE_SHIPPING_FREEAMOUNT_DISPLAY',
	   'MODULE_SHIPPING_FREEAMOUNT_HIDE_SPECIALS',
	   'MODULE_SHIPPING_FREEAMOUNT_AMOUNT',
	   'MODULE_SHIPPING_FREEAMOUNT_AMOUNT1',
	   'MODULE_SHIPPING_FREEAMOUNT_ZONE'
	   );
 return $keys;
  }
}

Share this post


Link to post
Share on other sites

does anyone know of a reason that i couldnt use this mod with the purchase order mod? i need the seperate pricing per customer but i also need to allow for purchase orders.

thanks in advance

Share this post


Link to post
Share on other sites

Hi All!

More clues!

Hard to say, but at least the page in the pop-up window is not called with an attribute_id like

 

attributes_groups.php?attributes_id=122. Because the save button is only shown when that is present (no

 

point saving anything when there is nothing meaningfull to save is it):

<?php echo '<p style="margin-top: 20px;"' . tep_image_submit('button_save.gif', IMAGE_SAVE, 

'name="submitbutton"') . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL, 'onclick=\'self.close()\'') 

.'</p>' . "\n";
?>
</form>
</div>
<?php
} // end if (isset($attribute_no))
 else {
echo '<div align="center" style="margin-top: 50px;">' . "\n" . '<form name="close">' . "\n" . tep_image_button

('button_cancel.gif', IMAGE_CLOSE, 'onclick=\'self.close()\'') .'</form>' . "\n" . '</div>' . "\n";
}
?>
</body>

Check the HTML of the products_attributes.php page to check that link.

...in products_attributes.php, just under the Products Attributes heading there's a message saying:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in

 

/home/a/company/www/catalog/admin/includes/functions/database.php on line 107

What's on line 106 to 107 in database.php?

This:

function tep_db_num_rows($db_query) {

return mysql_num_rows($db_query);

}

What am I doing wrong?

 

//Micke

Share this post


Link to post
Share on other sites
...in products_attributes.php, just under the Products Attributes heading there's a message saying: What's on line 106 to 107 in database.php?

This: What am I doing wrong?

You are asking for the results of a query where there hasn't been any. As you could have figured out from the place and message this is the piece you are likely referring to (starts around line 645):

  $per_page = MAX_ROW_LISTS_OPTIONS;
// BOF  SPPC, get products name from products_description now instead of doing a query with each attribute
 $attributes = "select pa.*, pd.products_name from " . TABLE_PRODUCTS_ATTRIBUTES . " pa left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on pa.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name";
// EOF  SPPC
 $attribute_query = tep_db_query($attributes);

 $attribute_page_start = ($per_page * $attribute_page) - $per_page;
 $num_rows = tep_db_num_rows($attribute_query);

Is there are reason you can't use the products_attributes.php file from the package?

Share this post


Link to post
Share on other sites

[... the "Warning: mysql_num_rows(): supplied argument ..." was a cut-and-paste mistake.]

 

When I first installed this contribution I did use the "products_attributes.php" from the package.

That resulted in the earlier "no save button"-post above here.

After that I thought I'd try to edit the "products_attributes.php" as per the install instructions.

Still no save button, but this time with the, now corrected, cut-and-paste mistake..

 

//Micke

Share this post


Link to post
Share on other sites
When I first installed this contribution I did use the "products_attributes.php" from the package.

That resulted in the earlier "no save button"-post above here.

OK. I went through the popup window code (attributes_groups.php) again and it looks like a ">" on a paragraph tag is missing. That might be it?

Can you change it to:

<?php echo '<p style="margin-top: 20px;">' . tep_image_submit('button_save.gif', IMAGE_SAVE, 'name="submitbutton"') . '?' . tep_image_button('button_cancel.gif', IMAGE_CANCEL, 'onclick=\'self.close()\'') .'</p>' . "\n";
?>
</form>
</div>

So instead of echo '<p style="margin-top: 20px;"' . tep_image_submit('button_save.gif', IMAGE_SAVE, it now says echo '<p style="margin-top: 20px;">' . tep_image_submit('button_save.gif', IMAGE_SAVE, ?

Share this post


Link to post
Share on other sites

Thanks JanZ! - Thats's working!

Absolutely brilliant! You are a genius!

 

OK. I went through the popup window code (attributes_groups.php) again and it looks like a ">" on a paragraph tag is missing. That might be it?

Can you change it to:

<?php echo '<p style="margin-top: 20px;">' . tep_image_submit('button_save.gif', IMAGE_SAVE, 'name="submitbutton"') . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL, 'onclick=\'self.close()\'') .'</p>' . "\n";
?>
</form>
</div>

So instead of echo '<p style="margin-top: 20px;"' . tep_image_submit('button_save.gif', IMAGE_SAVE, it now says echo '<p style="margin-top: 20px;">' . tep_image_submit('button_save.gif', IMAGE_SAVE, ?

 

Now I'll try to fix my classes/shopping_cart.php.

my one is a little different from the one in the install package)

//Micke

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

×