Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to install a patch to oscommerce


Guest

Recommended Posts

Posted

Hi!

This is probably a silly question but I don't know how to patch a php file and i need to trie in my site this contribuition:

Quantity Price Breaks Per Product.

Thank you

  • 1 month later...
Posted

The question may or may not be silly, but I have the same question, and for the same contribution. I DO know how to apply a patch, but the contribution was apparently created for a version of osc that is not one of the standard ones - patch complained a lot - and applying the diffs by hand seems rather daunting.

 

Please point me to a description of how I should be applying the patch - thanks.

 

Steve

Posted

no this is not a silly question at all. Some patches just require you to upload things to the proper folders. Some require editing of a certain file and uploading certain files. Some just are editing files or uploading mysql data....etc...list goes on......so no this is not a silly question.

 

 

 

# $Id: README,v 1.1 2003/05/20 14:41:09 abaucom Exp $

********************************************************************

*

* OSCommerce Patch

*

* Name:    Price Break

* 

* Author:  Andrew Baucom ([email protected])

*

* Purpose: 1) To allow quantity based pricing per product

*          2) To allow the ability to sell a product in

*             lots of # quantity only.

*

* Date:    May 13, 2003

*

* Revisions: 5/13/2003 - Initial 1.0

*            5/20/2003 - Modified product_listing.php to display

*                        price as 'x.xx - y.yy' if price break in use

*                      - MODIFIED release PATCH file format to

*                        include both admin and catalog

*            5/22/2003 - Modified classes/order.php to correct

*                        final_price on checkout... d'oh!

*

********************************************************************



********************************************************************

Overview



OSCommerce (www.oscommerce.org) open source e-commerce solution

does not by default allow quantity pricing.  This module configures

the database and code to allow:



1) Quantity pricing per product (currently 4 price break levels)

2) Ability to force products to be sold in lots of # quantity.





********************************************************************

Files Modified



.../admin/categories.php

.../admin/includes/languages/english/categories.php

.../catalog/stylesheet.css

.../catalog/product_info.php

.../catalog/includes/application_top.php

.../catalog/includes/classes/shopping_cart.php

.../catalog/includes/classes/order.php

.../catalog/includes/modules/order_details.php

.../catalog/includes/modules/product_listing.php

.../catalog/includes/languages/english/product_info.php



Files Added



.../catalog/includes/functions/awb_pb.php





********************************************************************

Installation



This installation assumes that you know how to tweak the tep code

and database.



0) Backup your code and database.



1) Modify the 'products' data table: (MySQL commands shown)



alter table products add column products_price1 decimal(15,4) not null default 0.0;

alter table products add column products_price2 decimal(15,4) not null default 0.0;

alter table products add column products_price3 decimal(15,4) not null default 0.0;

alter table products add column products_price4 decimal(15,4) not null default 0.0;

alter table products add column products_price1_qty_from int not null default 0;

alter table products add column products_price2_qty_from int not null default 0;

alter table products add column products_price3_qty_from int not null default 0;

alter table products add column products_price4_qty_from int not null default 0;

alter table products add column products_price1_qty_to int not null default 0;

alter table products add column products_price2_qty_to int not null default 0;

alter table products add column products_price3_qty_to int not null default 0;

alter table products add column products_price4_qty_to int not null default 0;

alter table products add column products_qty_blocks int not null default 1;



2) Apply code patches to admin and catalog.  I recommend that you check out

  a fresh copy of oscommerce and apply these patches to that copy and then

  migrate any changes into your existing store.  If your store is like mine

  then you have already heavily modified the code.  I found this is the

  cleanest and easiest way to support patches.



    cd /YOUR-STORE-ROOT

    patch -p1 < /WHEREVER/awb_pb_1.0-YYYYMMDD.diff



  YOUR-STORE-ROOT is the directory above the main admin and catalog dirs,

  such that you see:

    ./admin/LICENSE

    ./admin/admin/index.php

    ./catalog/LICENSE

    ./catalog/catalog/default.php   







********************************************************************

Usage



The admin portion of this module allows for extra pricing information

to be entered on the product page.  After the standard 'Products Price:'

entry you will find the following fields and is best shown by example.



Products Price:      _______

Quantity Blocks:     _______

Price Break Level 1: _______ Qty From: ______  Qty To: _____

Price Break Level 2: _______ Qty From: ______  Qty To: _____

Price Break Level 3: _______ Qty From: ______  Qty To: _____

Price Break Level 4: _______ Qty From: ______  Qty To: _____





Example 1:



Products Price:      3.75___

Quantity Blocks:     12_____

Price Break Level 1: 4.50___ Qty From: 1_____  Qty To: 59___

Price Break Level 2: 3.95___ Qty From: 60____  Qty To: 359__

Price Break Level 3: 3.85___ Qty From: 360___  Qty To: 719__

Price Break Level 4: 3.75___ Qty From: 719___  Qty To: 0____





* The standard price of this item is 3.75.



* The customer can only purchase this product in 12 unit

 increments. The shopping cart will enforce this requirement.



* The price calculated if the customer selects a quantity between

 1 and 59 units is '4.50'.



* The price calculated if the customer selects a quantity between

 60 and 359 units is '3.95'.



* The price calculated if the customer selects a quantity between

 360 and 719 units is '3.85'.



* The price calculated if the customer selects a quantity of

 720 and greater units is '3.75' (the lowest price).



* NOTE: When price breaks are in affect, the value entered in the

 'Products Price' is never used in a calculation but *will* be

 used for default display of a products price. I simply set this

 to the lowest of the price break prices.





Example 2:



Products Price:      3.75___

Quantity Blocks:     1______

Price Break Level 1: 0.00___ Qty From: 0_____  Qty To: 0____

Price Break Level 2: 0.00___ Qty From: 0_____  Qty To: 0____

Price Break Level 3: 0.00___ Qty From: 0_____  Qty To: 0____

Price Break Level 4: 0.00___ Qty From: 0_____  Qty To: 0____



* This product has the standard price of 3.75.



* The customer can purchase this product in any number of units.



* No price breaks are in affect. This is the default and the

 product behaves as normal.







Example 3:



Products Price:      1.00___

Quantity Blocks:     1______

Price Break Level 1: 2.00___ Qty From: 1_____  Qty To: 1____

Price Break Level 2: 1.00___ Qty From: 2_____  Qty To: 0____

Price Break Level 3: 0.00___ Qty From: 0_____  Qty To: 0____

Price Break Level 4: 0.00___ Qty From: 0_____  Qty To: 0____



* The standard price of this item is 1.00.



* The customer can purchase this product in any number of units.



* The price calculated if the customer selects a single item is '2.00'.



* The price calculated if the customer selects a quantity greater

 than 1 (2 or more) is '1.00'.



* NOTE: When price breaks are in affect, the value entered in the

 'Products Price' is never used in a calculation but *will* be

 used for default display of a products price. I simply set this

 to the lowest of the price break prices.





********************************************************************

Caveats (always)



1) Rigorous sanity checks are *not* performed on the prices and values

  entered in the quantity blocks and price break entries.  It is

  highly possible that you can create a situation that does not work.

  

2) I have not tested the price break when used in conjunction with the

  attributes pricing.  It should work fine and the price break should

  be applied on the product's base price but *does not* take into

  account the attribute pricing.  This will probably not yield the

  results you want.   This really would require price breaks on the

  product attributes as well.  But if it works for your situation,

  great!



3) I have not fully tested the computation of taxes on these prices.

  They should work but if not, it would mean that I missed something

  in the code.



4) I have only tested this on RedHat Linux 7.3 with Apache/PHP.  If

  it works on Wintel boxen and others, great, if not...

  



********************************************************************

Future Enhancements



1) Rigorous sanity checks on the values entered for the price break

  levels.

  

2) Add a minimum quantity required entry.  This is an obvious enhancement

  but there are other modules that accomplish this for now.

  

3) Apply price breaks to product attribute costs.



4) More than 4 price breaks?





********************************************************************

Legal



* SEE THE LICENCE FILE *

 

that is the readme file that explain what to do with it....if that still doesnt help im sure i can find time sometime this week to help you out.

 

Steven Pignataro

www.corephp.com

Posted

Thanks for the reply, but I think you misunderstood my question.

 

I read the README and I understand the fundamentals of applying a patch. It's just that the patch provided doesn't seem to match a standard osc distribution and I don't seem to be able to find the distribution it does apply to. I can figure out how to get around the patch looking for files in a bizarre directory structure, but the line numbers appear to be almost all wrong and the patch fails miserably. (And yes, I am applying it to a fresh download.)

 

The mysql changes are straightforward and I already took care of those.

 

I haven't looked at other contributions yet to see how they're done, but it seems to me that use of patches against unusual distributions is rather pointless. Or I may be missing an insight here.

 

Failing this, do you know of another contribution that offers this feature (quantity price breaks) that isn't such a pain to install? Thanks.

 

Steve

Posted

Going through the diff file for this contribution, they are all based on the tep-20030522 CVS.

 

However, as you say, trying to work through the diff and put this into the files by hand on anything other than the tep-20030522 CVS is virtually impossible (or at the very least extremely time consuming and prone to error).

 

Is there anyone out there that has already got this contrib working, ideally on either 2.2MS1 or Loaded5. The contrib is exactly what we and I'm sure a load of other sites want. Either that, or can the author give us a bit more of a hand with copying up his amended files so that we can use something like Beyond Compare to go through the amended files and match over the differences.

 

There are a lot of lines to change, so any help from someone out there would be gratefully recevied.

Posted

I gave up on this one and decided to use the much larger Shoppe Enhancement Controller, which includes this feature. SEC is based on the 20030518 snapshot and uses replacement files, not patches. This I can figure out (and the documentation includes a pointer to the proper snapshot). SEC has some other interesting features I may use.

 

My conclusion is that patch-based contributions are mostly useless.

 

Steve

Archived

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

×
×
  • Create New...