Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

10 + [xx]


Guest

Recommended Posts

Hi there,

 

There may be a contrib but I am not sure what you would call it, I searched around a bit to no avail.

 

The problem:

 

We have some low margin items that are cheap and need to be sold in groups of more than ten. I would like to put 10+ before the quantity select dropdown, and have the total (eg 19) show up as the quantity in the cart.

 

The solution:

 

One possible solution is to edit the drop down to START at 10, but I have lotws of other products that should be sold individually.

 

Is there a cleaner way to do this? Or a contrib?

 

 

Thx,

 

R

Link to comment
Share on other sites

Hrm...there is something similar that could at least get you a start - I believe it's called Quantity Discounts or something like that. It's designed for products that are sold in bulk - ie, by the case. It would allow you to display the price of one of the item, but force it to be sold in blocks of whatever quantity you want. As an example, you could say tha the price of a can of Coke is 50c, but you have to buy a case at a time. The quantity block is editable on a per product basis, and you can even give discounts for buying multiple cases (so if you buy 12 cans of Coke they're 50c each, but if you buy 24 cans they're 45c each, etc).

 

This isn't exactly what you're looking for, but it could be a base to work from.

Chris Dunning

osCommerce, Contributions Moderator Team

 

Please do not send me PM! I do not read or answer these often. Use the email button instead!

 

I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly.

Link to comment
Share on other sites

  • 2 weeks later...

you ould make another field in the product table called for example '10PLUS'

make a checkbox for it in the product entry page in the admin.

and you can then call it in the products page and code

 

if 10PLUS is true then use the 10plus drop down

else use the regular drop down.

K Groner

Link to comment
Share on other sites

  • 7 months later...

R

Did you ever solve this problem? I've looked deeply into all the contributions I can find and nothing fully answers what is a straight forward ecommerce function.

 

I'd like to put a drop down menu with fixed quantities in (6,12,24 etc, no single default quantities), on the product, with prices advertised as 'each', but discounts on mutli quantities.

mike

Link to comment
Share on other sites

I designed something like this for a client, maybe it could give you some ideas.

 

This particular store sells tools - some of them are large and are sold in packages of 1, some are sold in packages of 3, some in 6, etc. I started with Quantity Price Breaks (I think that's the name) for the admin side and some of the shopping cart functionality. I then built a custom product listing, slightly modified from the a contribution that allows you to add multiple products to your cart at once. If a quantity block (package size) is defined in the admin screen, a dropdown is created in multiples of that package size - for something sold in packages of 3, the dropdown would be 3,6,9,12,etc. For products without a quantity block defined, a text input box is given.

 

You can see this in action at the following links. As I'm writing this, the site is not live - but it may be in the near future. No test orders please. These links may change without notice.

 

Product listing without quantity blocks:

http://www.kodiakcuttingtools.net/index.php?cPath=61_62

Product listing WITH quantity blocks:

http://www.kodiakcuttingtools.net/index.php?cPath=67_68

 

I believe this is what you're looking for, I hope my suggestions can help you.

Chris Dunning

osCommerce, Contributions Moderator Team

 

Please do not send me PM! I do not read or answer these often. Use the email button instead!

 

I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly.

Link to comment
Share on other sites

Hi there,

 

There may be a contrib but I am not sure what you would call it, I searched around a bit to no avail.

 

The problem:

 

We have some low margin items that are cheap and need to be sold in groups of more than ten.  I would like to put 10+ before the quantity select dropdown, and have the total (eg 19) show up as the quantity in the cart.

 

The solution:

 

One possible solution is to edit the drop down to START at 10, but I have lotws of other products that should be sold individually.

 

Is there a cleaner way to do this? Or a contrib?

Thx,

 

R

 

 

why not simply make the batch of 10 a product.

you order 1 or 2 or 3 package(s) of 10 items.

call it "the sixpack" principle

Treasurer MFC

Link to comment
Share on other sites

  • 1 month later...

I vote with the Quantity Discount suggestion...but I'm pretty biased. I have a lot of clients that absolutely love it. They all report it allows an easy method of giving that extra little push to get 2 or 3 instead of 1-2 items at a time. Plus, it is an extremely well coded contribution with only one bug: when a product has a special price and also quantity price blocks the display price is either not displayed or skewed. This bug also affects addition to the cart. Here is a revised class but didn't comment it from original...maybe someone would like to compare/diff the two and post an updated contribution.

 

<?php
/*
 $Id: PriceFormatter.php,v 1.6 2003/06/25 08:29:26 petri Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

/*
   PriceFormatter.php - module to support quantity pricing

   Created 2003, Beezle Software based on some code mods by WasaLab Oy (Thanks!)
*/

class PriceFormatter {
 var $hiPrice;
 var $lowPrice;
 var $quantity;
 var $hasQuantityPrice;

 function PriceFormatter($prices=NULL) {
   $this->productsID = -1;

   $this->hasQuantityPrice=false;
   $this->hasSpecialPrice=false;

   $this->hiPrice=-1;
   $this->lowPrice=-1;

   for ($i=1; $i<=8; $i++){
     $this->quantity[$i] = -1;
     $this->prices[$i] = -1;
   }
   $this->thePrice = -1;
   $this->specialPrice = -1;
   $this->qtyBlocks = 1;

   if($prices)
     $this->parse($prices);
 }

 function encode() {
$str = $this->productsID . ":"
       . (($this->hasQuantityPrice == true) ? "1" : "0") . ":"
       . (($this->hasSpecialPrice == true) ? "1" : "0") . ":"
       . $this->quantity[1] . ":"
       . $this->quantity[2] . ":"
       . $this->quantity[3] . ":"
       . $this->quantity[4] . ":"
    . $this->quantity[5] . ":"
    . $this->quantity[6] . ":"
    . $this->quantity[7] . ":"
       . $this->quantity[8] . ":"
       . $this->price[1] . ":"
       . $this->price[2] . ":"
       . $this->price[3] . ":"
       . $this->price[4] . ":"
    . $this->price[5] . ":"
    . $this->price[6] . ":"
    . $this->price[7] . ":"
       . $this->price[8] . ":"
       . $this->thePrice . ":"
       . $this->specialPrice . ":"
       . $this->qtyBlocks . ":"
       . $this->taxClass;
return $str;
 }

 function decode($str) {
list($this->productsID,
     $this->hasQuantityPrice,
     $this->hasSpecialPrice,
     $this->quantity[1],
     $this->quantity[2],
     $this->quantity[3],
     $this->quantity[4],
     $this->quantity[5],
     $this->quantity[6],
     $this->quantity[7],
     $this->quantity[8],
     $this->price[1],
     $this->price[2],
     $this->price[3],
     $this->price[4],
     $this->price[5],
     $this->price[6],
     $this->price[7],
     $this->price[8],
     $this->thePrice,
     $this->specialPrice,
     $this->qtyBlocks,
     $this->taxClass) = explode(":", $str);

$this->hasQuantityPrice = (($this->hasQuantityPrice == 1) ? true : false);
$this->hasSpecialPrice = (($this->hasSpecialPrice == 1) ? true : false);
 }

 function parse($prices) {
   $this->productsID = $prices['products_id'];
   $this->hasQuantityPrice=false;
   $this->hasSpecialPrice=false;

   $this->quantity[1]=$prices['products_price1_qty'];
   $this->quantity[2]=$prices['products_price2_qty'];
   $this->quantity[3]=$prices['products_price3_qty'];
   $this->quantity[4]=$prices['products_price4_qty'];
   $this->quantity[5]=$prices['products_price5_qty'];
   $this->quantity[6]=$prices['products_price6_qty'];
   $this->quantity[7]=$prices['products_price7_qty'];
   $this->quantity[8]=$prices['products_price8_qty'];

   $this->thePrice=$prices['products_price'];
   $this->specialPrice=$prices['specials_new_products_price'];
   $this->hasSpecialPrice=tep_not_null($this->specialPrice);

#if ($this->hasSpecialPrice) $this->thePrice = $this->specialPrice;

$this->price[1]=$prices['products_price1'];
   $this->price[2]=$prices['products_price2'];
   $this->price[3]=$prices['products_price3'];
   $this->price[4]=$prices['products_price4'];
$this->price[5]=$prices['products_price5'];
$this->price[6]=$prices['products_price6'];
$this->price[7]=$prices['products_price7'];
   $this->price[8]=$prices['products_price8'];


    /*
      Change support special prices
   If any price level has a price greater than the special
   price lower it to the special price
*/
if ($this->hasSpecialPrice == true) {
 for($i=1; $i<=8; $i++) {
	 if ($this->price[$i] > $this->specialPrice)
   $this->price[$i] = $this->specialPrice;
 }
}
//end changes to support special prices

   $this->qtyBlocks=$prices['products_qty_blocks'];

   $this->taxClass=$prices['products_tax_class_id'];

   if ($this->quantity[1] > 0) {
     $this->hasQuantityPrice = true;
     $this->hiPrice = $this->thePrice;
     $this->lowPrice = $this->thePrice;

     for($i=1; $i<=8; $i++) {
if($this->quantity[$i] > 0) {
  if ($this->price[$i] > $this->hiPrice) {
    $this->hiPrice = $this->price[$i];
  }
  if ($this->price[$i] < $this->lowPrice) {
    $this->lowPrice = $this->price[$i];
  }
}
     }
   }
 }

 function loadProduct($product_id, $language_id=1)
 {
   $sql="select pd.products_name, p.products_model, p.products_image, p.products_id," .
       " p.manufacturers_id, p.products_price, p.products_weight," .
       " p.products_price1,p.products_price2,p.products_price3,p.products_price4, p.products_price5,p.products_price6,p.products_price7,p.products_price8," .
       " p.products_price1_qty,p.products_price2_qty,p.products_price3_qty,p.products_pri
ce4_qty, p.products_price5_qty,p.products_price6_qty,p.products_price7_qty,p.products_pri
ce8_qty," .
       " p.products_qty_blocks," .
       " p.products_tax_class_id," .
       " IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price," .
       " IF(s.status, s.specials_new_products_price, p.products_price) as final_price" .
       " from " . TABLE_PRODUCTS_DESCRIPTION . " pd," .
       "      " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id," .
       "      " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id" .
       " where p.products_status = '1'" .
       "   and p.products_id = '" . (int)$product_id . "'" .
       "   and pd.products_id = '" . (int)$product_id . "'" .
       "   and pd.language_id = '". (int)$language_id ."'";

   $product_info_query = tep_db_query($sql);
   $product_info = tep_db_fetch_array($product_info_query);
   $this->parse($product_info);

   return $product_info;
 }

 function computePrice($qty)
 {
$qty = $this->adjustQty($qty);

$price = $this->thePrice;

if ($this->hasSpecialPrice == true)
 $price = $this->specialPrice;
//else
 for ($i=1; $i<=8; $i++)
	 if (($this->quantity[$i] > 0) && ($qty >= $this->quantity[$i]))
   $price = $this->price[$i];

return $price;
 }

 function adjustQty($qty) {
// Force QTY_BLOCKS granularity
$qb = $this->getQtyBlocks();
if ($qty < 1)
 $qty = 1;

if ($qb >= 1)
{
 if ($qty < $qb)
	 $qty = $qb;

 if (($qty % $qb) != 0)
	 $qty += ($qb - ($qty % $qb));
}
return $qty;
 }

 function getQtyBlocks() {
   return $this->qtyBlocks;
 }

 function getPrice() {
   return $this->thePrice;
 }

 function getLowPrice() {
   return $this->lowPrice;
 }

 function getHiPrice() {
   return $this->hiPrice;
 }

 function hasSpecialPrice() {
   return $this->hasSpecialPrice;
 }

 function hasQuantityPrice() {
   return $this->hasQuantityPrice;
 }

 function getPriceString($style='productPriceInBox') {
   global $currencies;

//Change support special prices
//don't display special prices.....
   if (false == true) {
     $lc_text = ' <s>'
. $currencies->display_price($this->thePrice,
        tep_get_tax_rate($this->taxClass))
. '</s>  <span class="productSpecialPrice">'
. $currencies->display_price($this->specialPrice,
        tep_get_tax_rate($this->taxClass))
. '</span> ';
   }
   else {

     // If you want to change the format of the price/quantity table
     // displayed on the product information page, here is where you do it.

     if($this->hasQuantityPrice == true) {
$lc_text = '<table border="0" cellspacing="0" cellpadding="0" class="infoBox">
   <tr valign="top">
   <td>
   <table border="0" cellspacing="1" cellpadding="5" class="infobox">';
       $lc_text .= '<tr valign="top"><td width="150" class="infoBoxHeading">QTY</td>'
//          . $currencies->display_price($this->thePrice,
//        tep_get_tax_rate($this->taxClass))
              . '</td>';

for($i=1; $i<=8; $i++) {
  if($this->quantity[$i] > 0) {
    $lc_text .= '<td align="center" width="50" class="infoBoxHeading">'
      . $this->quantity[$i]
      .'+ </td>';
  }
}
// 	 <tr valign="top"><td width="150" class="infoBoxContents">M1P102</td><td align="center" width="50" class="infoBoxContents">'
//       . $currencies->display_price($this->price[$i],
//        tep_get_tax_rate($this->taxClass))

$lc_text .= '<tr valign="top"><td width="150" class="infoBoxContents">Price ea.</td>';

for($i=1; $i<=8; $i++) {
  if($this->quantity[$i] > 0) {
    $lc_text .= '<td align="center" width="50" class="infoBoxContents">'
      . $currencies->display_price($this->price[$i],
       tep_get_tax_rate($this->taxClass))
      	 .'</td>';
  }
}
$lc_text .= '</tr></table></td></tr></table>';
     }
     else {
   if ( $this->hasSpecialPrice ) {
	 $lc_text = '<s>' . $currencies->display_price($this->thePrice, tep_get_tax_rate($this->taxClass)) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($this->specialPrice, tep_get_tax_rate($this->taxClass)) . '</span>';
 } else {
	 $lc_text = ' ' . $currencies->display_price($this->thePrice, tep_get_tax_rate($this->taxClass)). ' ';
   }
 
     }
   }
   return $lc_text;
 }

 function getPriceStringShort() {
   global $currencies;

   if ($this->hasSpecialPrice == true) {
     $lc_text = ' <s>'
. $currencies->display_price($this->thePrice,
        tep_get_tax_rate($this->taxClass))
. '</s>  <span class="productSpecialPrice">'
. $currencies->display_price($this->specialPrice,
        tep_get_tax_rate($this->taxClass))
. '</span> ';
   }
   else {
     if($this->hasQuantityPrice == true) {
$lc_text = ' '
  . $currencies->display_price($this->lowPrice,
          tep_get_tax_rate($this->taxClass))
  . ' - '
  . $currencies->display_price($this->hiPrice,
          tep_get_tax_rate($this->taxClass))
  . ' ';
     }
     else {
$lc_text = ' '
  . $currencies->display_price($this->thePrice,
          tep_get_tax_rate($this->taxClass))
  . ' ';
     }
   }
   return $lc_text;
 }
}
?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...