Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

how to multiply the total price.


peteravu

Recommended Posts

Posted

I like to sell only by dozen, but only display the price per unit like it dos now.

 

So how to just multiply by 12 for the total?

 

Sample:

Buy 1 of 1$ = total in shopping cart and checkout 12$

Buy 2 of 1$ = total in shopping cart and checkout 24$

 

What changes to do and where?

Posted

I don't know if you would have any use for the main function of the Quantity Price Breaks contrib, but it also includes a feature to establish "quantity blocks". In the product setup page in admin it adds a box to enter the number of units required. For example if you want to sell in blocks of 12 then it would enforce that.

 

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

Rule #1: Without exception, backup your database and files before making any changes to your files or database.

Rule #2: Make sure there are no exceptions to Rule #1.

Posted

Thanks graphicsguy

 

I looked on Quantity Price Breaks and made only 2 changes, can anybody let me know if I have to change more? What about shipping? Do I have to change more weights their have to be multiplied by 12

 

In catalog\includes\classes\shopping_cart.php

I add *12 after products_price, weight and volume

 

 

// products price
       $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
       $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight, products_volume from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
       if ($product = tep_db_fetch_array($product_query)) {
         $prid = $product['products_id'];
         $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
         $products_price = $product['products_price']*12;
         $products_weight = $product['products_weight']*12;
         $products_volume = $product['products_volume']*12;

and add *12 after products_price

      $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
       $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
       if ($products = tep_db_fetch_array($products_query)) {
         $prid = $products['products_id'];
         $products_price = $products['products_price']*12;

         $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
         if (tep_db_num_rows($specials_query)) {
           $specials = tep_db_fetch_array($specials_query);
           $products_price = $specials['specials_new_products_price'];
         }

Archived

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

×
×
  • Create New...