Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / separate charge for specific item

separate charge for specific item

Locked

Views: 1,683

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
31 Jul 2009, 4:41 PM
#1
smallpigpig avatar

smallpigpig

New Zenner

Join Date:
Sep 2007
Posts:
79
Plugin Contributions:
0

separate charge for specific item

Hi All!

I have been searching for info on this.. but i don't even know what keywords I can search for.. lol..

here goes:

currently, i have a flat rate, free shipping and local pick up option.

my flat rate shipping is this:

total: under 49 - shipping is 7.00
between 50-99 shipping is 9
over 100 shipping is free

i just added an item that requires a separate shipping. What im trying to do is if a customer just buy that specific item (no matter how much the quantity is, it will be 3.50...

but if they combine anything else with that item (that are not the same), it will bounce back to the above flat shipping method..

I tried adding another shipping method (ie: a new shipping option)
but now people are selecting that 3.50 shipping NO MATTER what they buy...(because its the cheapest)

so what I was wondering if there is a way to code the condition so that zen cart will automatically select 3.50 if the customer is ONLY buys that item....

sorry if its confusing. im so confused myself lol

any help would be appreciated! thanks in advance!

6 Aug 2009, 9:39 PM
#2
smallpigpig avatar

smallpigpig

New Zenner

Join Date:
Sep 2007
Posts:
79
Plugin Contributions:
0

Re: separate charge for specific item

anyone?

9 Aug 2009, 2:05 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: separate charge for specific item

Have you customized your Shipping Module(s)?

Flat Rate flat shipping is just that ... a Flat Rate without any change based on the Order amount ...

You are indicating that you have various Flat Rate charges based on Order Amount ...

10 Aug 2009, 2:04 AM
#4
smallpigpig avatar

smallpigpig

New Zenner

Join Date:
Sep 2007
Posts:
79
Plugin Contributions:
0

Re: separate charge for specific item

thank linda for your response..

i guess in sort, i would love to have flat rate & a specific price for a specific item.. i know i know.. im asking for too much.. lol

its just that because i have a "flat rate" for a specific product, it shows up in all the shipping options, and of course, zen cart programs it so that the button for the cheapest shipping is highlighted..

so what im saying is that people are choosing the cheapest (abeit wrong) option for shipping..

is there a way to only have the 3.50 option show during the times the customer selects the item and that item only?

Ajeh:

Have you customized your Shipping Module(s)?

Flat Rate flat shipping is just that ... a Flat Rate without any change based on the Order amount ...

You are indicating that you have various Flat Rate charges based on Order Amount ...

10 Aug 2009, 3:47 AM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: separate charge for specific item

You could always build something into your shipping modules to test for that product and if it exists then turn off all the shipping modules that should not show and turn on the shipping module that should show ...

You can test what is in the shopping cart via a function in the shopping_cart class:

  /**
   * Method to calculate the number of items in a cart based on an abitrary property
   *
   * $check_what is the fieldname example: 'products_is_free'
   * $check_value is the value being tested for - default is 1
   * Syntax: $_SESSION['cart']->in_cart_check('product_is_free','1');
   *
   * @param string product field to check
   * @param mixed value to check for
   * @return integer number of items matching restraint
   */
  function in_cart_check($check_what, $check_value='1') {
10 Aug 2009, 6:10 AM
#6
smallpigpig avatar

smallpigpig

New Zenner

Join Date:
Sep 2007
Posts:
79
Plugin Contributions:
0

Re: separate charge for specific item

Ajeh:

You could always build something into your shipping modules to test for that product and if it exists then turn off all the shipping modules that should not show and turn on the shipping module that should show ...

You can test what is in the shopping cart via a function in the shopping_cart class:

/**

  • Method to calculate the number of items in a cart based on an abitrary property
  • $check_what is the fieldname example: 'products_is_free'
  • $check_value is the value being tested for - default is 1
  • Syntax: $_SESSION['cart']->in_cart_check('product_is_free','1');
  • @param string product field to check
  • @param mixed value to check for
  • @return integer number of items matching restraint
    */
    function in_cart_check($check_what, $check_value='1') {

hi linda!

i really appreciate your time and efforts, but sadly, im such a novice, i have no idea what your last post meant.. would you mind explaining how the testing and switching is written in php?

my sincere apologies
10 Aug 2009, 1:43 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: separate charge for specific item

Let's say you wanted to customize Flat Rate shipping to charge $3.50 when products_id 12 is in the cart, regardless of quantity ...

Edit the module and change the function quote to read:

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

      global $cart;
      $chk_how_many12 = $_SESSION['cart']->in_cart_check('products_id', '12');
      if ($chk_how_many12 > 0) {
// charge 3.50 if products_id 12 is in the cart
      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
                                                     'cost' => 3.50)));
      } else {
// charge regular flat rate if products_id 12 is NOT in the cart
      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
                                                     'cost' => MODULE_SHIPPING_FLAT_COST)));
      }
      if ($this->tax_class > 0) {
        $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
      }

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

      return $this->quotes;
    }
10 Aug 2009, 6:26 PM
#8
smallpigpig avatar

smallpigpig

New Zenner

Join Date:
Sep 2007
Posts:
79
Plugin Contributions:
0

Re: separate charge for specific item

Ajeh:

Let's say you wanted to customize Flat Rate shipping to charge $3.50 when products_id 12 is in the cart, regardless of quantity ...

Edit the module and change the function quote to read:

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

  global $cart;
  $chk_how_many12 = $_SESSION['cart']->in_cart_check('products_id', '12');
  if ($chk_how_many12 > 0) {

// charge 3.50 if products_id 12 is in the cart
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
'cost' => 3.50)));
} else {
// charge regular flat rate if products_id 12 is NOT in the cart
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
'cost' => MODULE_SHIPPING_FLAT_COST)));
}
if ($this->tax_class > 0) {
$this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}

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

  return $this->quotes;
}

LInda, thank you so much for taking the time to explain it....i think im starting to see the light lol

but how do you code it if you want to charge 3.50 ONLY if that item is the only item in the cart (regardless of quantity).  - standalone item

so if they mix it up with other items, the pricing goes back to normal shipping..
10 Aug 2009, 7:05 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: separate charge for specific item

You need to add another condition to the IF:

      if ($chk_how_many12 > 0) {

where you also test that the number of:
$chk_how_many12

would equal the total items in the cart ...

12 Feb 2010, 11:26 PM
#10
skyman2345 avatar

skyman2345

New Zenner

Join Date:
Feb 2010
Posts:
4
Plugin Contributions:
0

Re: separate charge for specific item

I have a problem, I have 4 items on my zen cart site... I want flat priced shipping options for each one and I can't find a way to do that, it displays all shipping options available for each product.

For example: 1 box of our product, flat shipping $6.95 for First Class mail, with an option for $11.95 for Priority and $13.95 for Canada First Class

For 3 boxes of our product, I want flat shipping of $12.95 offered via priority mail and $18.95 for Canada First Class and I dont' want the $6.95 first class mail option for the single box to show up.

Is there a way to do this?

Thank you very much! I am in a huge time cruch. :)

12 Feb 2010, 11:59 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: separate charge for specific item

You would need to write a custom shipping module to manage this type of shipping ...