47 replies [Last post]
tortoise's picture
Offline
Joined: 05/04/2008
Juice: 14
Was this information Helpful?

I would love to have the option to specify price adjustments not as prices added to or subtracted from the base price, but as multipliers or percentages of the base price. I see a few places where this could be useful:

-You have an attribute with differently-priced options for a product, maybe the size of a product. You want the price of the larger size to be 50% more than the price of the regular size, but the price of whatever you're selling fluctuates frequently. This way, you only have to edit the base price when it goes up or down, and the price for the large size will adjust accordingly. Without multipliers, you have to edit the price adjustment for each option.

-Similarly, you have a product kit where you want to give the customer a 25% discount over buying the component products separately, but the component products have attribute options which alter their prices. You simply cannot do this with a flat price adjustment.

I imagine the implementation would have the store administrator specify what type of price modifier they want: the current standard price adjustment (-2.00 for an $8.00 base price), a percent multiplier (75%), or a percent adjustment (-25%). And in these cases, they could choose whether to display the modifier in the attribute selection process as a (calculated) flat price adjustment, a multiplier, a percent adjustment (formatted as "save 25%" or "25% off"), or the final adjusted price. This would apply similarly to the product kit module.

jasmeetc@drupal.org's picture
Offline
Joined: 08/27/2008
Juice: 4
would like to have this

I would like to have this too. Any way of doing this today?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15459
Re: would like to have this

This is in the feature request queue and something I agree should be available, but as far as I know this is not possible today.

Bartezz's picture
Offline
Joined: 04/18/2008
Juice: 104
Re: Re: would like to have this

Has this request made it to the front of the queue yet?

Regards

rendog's picture
Offline
Joined: 10/21/2009
Juice: 7
Ubercart Attribute Multiplier

Hi Ryan,

do you know if any further development has taken place on this module. Any help would be greatly appreciated.

Regards.
Renny.

zeezhao's picture
Offline
Joined: 04/23/2008
Juice: 1075
Re: Price adjustments by multipliers

Have you tried out this contribution?

http://www.ubercart.org/contrib/7588#comment-29558

Bartezz's picture
Offline
Joined: 04/18/2008
Juice: 104
Re: Re: Price adjustments by multipliers

Looking like a handy contrib but from what I've gathered it's not doing what was asked in this post.
Besides that it's not a solution to the prob either.

If your product is, let's say, T-shirts.
The attributes to go with t-shirts are: front-print +10%, back-print +10%, long-sleeve +10%

You could create a new product with the attributes class; tshirts and only have to set the sell price.
The attributes cost will be calculated based upon sell price.

For a $10 t-shirt with that attribute class you'd pay $11 if you want a front-print, without having to change the option costs per product.
For a $50 t-shirt with that attribute class you'd pay $55 if you want a front-print, without having to change the option costs per product.

If you raise the sell price by hand or with the module you mentioned the attributes would go up in price too!

But this is currently not the case, if you update the sell price (by hand or automated) you still have to go into the product's options and change the option costs cause they are in currency units and not in percentage!

Hope this will change soon Smiling

Cheers

timl@drupal.org's picture
Offline
Joined: 03/19/2009
Juice: 10
Re: Price adjustments by multipliers

I second this request - my usecase is where a product is for a yearly license multiplied by quantity, but I'd really like to multiply the total cost by the number of licenses they purchase (i.e. attribute = # of licenses)

look forward to seeing a solution

dkruse@drupal.org's picture
Offline
Joined: 04/30/2008
Juice: 45
Re: Re: Price adjustments by multipliers

Is anybody working on this yet? I looked for it in the feature request queue but couldn't find it. If nobody is working on this, I will see what I can do. Is this a feature that is in Ubercart v2?

Juanzo@drupal.org's picture
Offline
Uber Donor
Joined: 05/05/2008
Juice: 79
The Mass Price Editor seems

The Mass Price Editor seems to be able to do this. We should wait until the developer haves some time to update it to Drupal 6.x

dkruse@drupal.org's picture
Offline
Joined: 04/30/2008
Juice: 45
Re: The Mass Price Editor seems

The Mass Price Editor will do this to the base price. What myself and others want is the ability to adjust the prices using multipliers with attributes/options. The Mass Price Editor doesn't seem to do this.

dkruse@drupal.org's picture
Offline
Joined: 04/30/2008
Juice: 45
Re: Re: The Mass Price Editor seems

I've created an initial version of this feature. You can find the patch at http://www.ubercart.org/contrib/10772. Enjoy!

timl@drupal.org's picture
Offline
Joined: 03/19/2009
Juice: 10
Alternative

closing the loop:
---

An alternative method I used instead that was pretty painless

http://drupal.org/project/uc_custom_price

in the 'uc_custom_price' textarea you get for the node you're editing

$licenses = $item->data['attributes'][3];
if (intval($licenses)){
   $item->price = $item->price*intval($licenses);
}else{
   drupal_set_message("Number of licenses is incorrect, must be a number ($licenses)","error");
}
#print_r($item);

The Attribute Tokens module looks like a good way of easily referencing the attributes without magic numbers like [3].. http://www.ubercart.org/contrib/2381

you may need to put a print_r($item) in the code to see what your $item object looks like

Hope this helps someone

Lunk Rat's picture
Offline
Joined: 06/08/2009
Juice: 15
Multiply base price by % given by attributes?

Any news on the best way to have attributes increase the base price by a percentage rather than a flat sum?

This is crucial for any e-commerce site selling consumables by weight; e.g. a 12 oz bag of coffee for $7.95 or a 32 oz bag for 226% more. Multiplying the base 12 oz price ($7.95) by a percentage determined by the weight attribute that the customer selects would be THE most efficient way of listing coffees. Some coffees cost more than others, so "scaling up" the base (12 oz) price based on weight is absolutely necessary in order to achieve correct pricing, reduce the number of attributes needed, and avoid unwanted complexity in managing products and prices.

If Ubercart had this functionality in the core attribute module, it would be a much more attractive solution for stores that want to price items by weight.

lincoln's picture
Offline
Joined: 12/23/2008
Juice: 11
Re: Multiply base price by % given by attributes?

Agree absolutely. I need similar solution not just because of weight but because of sizes of product.

lauraatamysragbag's picture
Offline
Joined: 02/24/2010
Juice: 68
Re: Alternative

Thanks! This was much more painless than I thought it would be, and I can't say I'm at all fluent in PHP.

I put:

$item->price = $item->price;
if('[Palette - First Choice]' == 'No preference' && '[Palette - Third Choice]' == 'None'){
$item->price = $item->price - $item->price *.15;
}
if('[Palette - Third Choice]' !== 'None' && '[Palette - First Choice]' !== 'No preference'){
$item->price = $item->price - $item->price *.1;
}

It works! Basically, I'm giving my customers a discount for not being picky. I left the second choice attribute out because, using CANO, it only shows up if the first choice is not 'No preference'.

kasmel's picture
Offline
Joined: 11/12/2009
Juice: 2
I have looked at this

In the attribute module I replaced

line 450 $item->price += $op_prices;

with

if($op_prices == 0){
$item->price += 0;
}
$item->price += ($item->price * $op_prices);

I used Restrict Qty to limit selection to just the attributes for the product, and created attributes including a 'price' as a multiplier. This was for a fabric retailer, so I had two sets of attributes. One for 1/4 yard = .25, 1/2 yard = .5, etc. And one for 1 = 1, 2 = 2, etc. I'm sure that using this with weights could be the same. I hope that something like this is implemented soon in core.

polmaresma's picture
Offline
Joined: 02/19/2008
Juice: 21
Hi! I'm interested on this

Hi!
I'm interested on this feature.
I wanna sell textil by increment of .25 meters. I wanna the sell_price to be the price of a meter and use an attribute with increments of .25 meters that shold byt multiplied by the meter price.

Any idea of how to do that? Anyone interested in developt it for UC2?

If anyonye please tell me the cost.

Thank's!

Jedediah Smith's picture
Offline
Joined: 07/07/2010
Juice: 25
Added a multiply column

This patch will add an additional column called multiplier. If the multiplier is left at 0 then it is not used. If a value is set in the multiplier column that number will be multiplied by the total price + any options already applied.

I will note that I had to make changes to the database schema (added a multiplier column to the uc_product_options, uc_class_attribute_options, and uc_attribute_options) I added the changes to uc_attributes.install but to apply them you have to disable, uninstall, and then re-enable the uc_attributes module or your could just add the schema changes manually using the following (assuming MySQL)

ALTER TABLE `uc_attribute_options` ADD COLUMN `multiplier` Decimal(16,5)  NOT NULL DEFAULT 0 AFTER `price`;
ALTER TABLE `uc_class_attribute_options` ADD COLUMN `multiplier` Decimal(16,5)  NOT NULL DEFAULT 0 AFTER `price`;
ALTER TABLE `uc_product_options` ADD COLUMN `multiplier` Decimal(16,5)  NOT NULL DEFAULT 0 AFTER `price`;

I have checked it on my setup and it seems to work but it has not been thoroughly tested so if anyone comes across any problems feel free to share them.

AttachmentSize
uc_attribute_add_multiplier.patch 19.78 KB

Jedediah Smith
Online By Design LLC

ndvo's picture
Offline
Joined: 08/15/2010
Juice: 8
It worked for me with Drupal 6, Ubercart 2.4

But I had to change line 458 of uc_attribute.module:

original:

   $op_prices = 0;

modified:

   $op_prices = $item->price;

The problem was it was reseting the item price to zero

Thanks Jedediah! You helped a lot.

Jedediah Smith's picture
Offline
Joined: 07/07/2010
Juice: 25
Thanks for finding the problem

You did point out a problem with my solution. In my implementation of the attributes I was actually only using options(the products had no base price). So it did not occur to me that my multiplier was only applied to price modifiers. Thank you for pointing this out. As I looked through this it is important that you also change line 470.

From:

<?php
$item
->price += $op_prices
?>

To:

<?php
$item
->price = $op_prices
?>

Or else the item's price will be added twice.

I updated the patch (this one doesn't touch the uc_attribute.install file so you have to do the sql on your own). So just copy multiplier.patch to your Ubercart directory and then go to that directory and run, you can read more about patches at http://drupal.org/patch/apply:
patch -p0 < multiplier.patch
Then run the SQL in my previous post.

AttachmentSize
multiplier.patch 18.18 KB

Jedediah Smith
Online By Design LLC

ndvo's picture
Offline
Joined: 08/15/2010
Juice: 8
Query at product class management

Thanks again Jedediah.

I had just another problem now, when trying to work with classes. It wos just a typo.

On line 566 of the uc_attribute.module the the multiplier is refered as to the table "po" when it should be "co".

I changed line 566 from this:

        $result = db_query("SELECT co.pcid, co.oid, co.cost, co.price, po.multiplier, co.weight, co.ordering, ao.name, ao.aid FROM {uc_class_attribute_options} AS co LEFT JOIN {uc_attribute_options} AS ao ON co.oid = ao.oid AND co.pcid = '%s' WHERE ao.aid = %d ORDER BY co.ordering, ao.name", $nid, $attr_id);

to this:

        $result = db_query("SELECT co.pcid, co.oid, co.cost, co.price, co.multiplier, co.weight, co.ordering, ao.name, ao.aid FROM {uc_class_attribute_options} AS co LEFT JOIN {uc_attribute_options} AS ao ON co.oid = ao.oid AND co.pcid = '%s' WHERE ao.aid = %d ORDER BY co.ordering, ao.name", $nid, $attr_id);

Everything worked just fine.

Jedediah Smith's picture
Offline
Joined: 07/07/2010
Juice: 25
Sorry about that

Sorry about the typo, must have happened making the patch for 2.4. I update the patch file.

AttachmentSize
multiplier.patch 18.18 KB

Jedediah Smith
Online By Design LLC

lauraatamysragbag's picture
Offline
Joined: 02/24/2010
Juice: 68
Re: Sorry about that

Thanks for this patch Jedediah. I haven't been able to get it working yet. I added some defoult multipliers to some of my options at admin/store/attributes/options but they don't show up when I go to configure options on the product and product class pages. I'm having a very similar problem with another module, so I'm pretty sure the problem is on my end. I will let you know if I figure it out.

lauraatamysragbag's picture
Offline
Joined: 02/24/2010
Juice: 68
Are negative multipliers possible?

Hi Jedediah,

I got the other module I was trying figured out and then tried to reinstall this patch. The UI where I can add multipliers to attributes looks fine but on the UI for product class and and product, the multiplier fields are on their own at the bottom of the page and they're not labeled. I'm using drupal 6.19 and Ubercart 6.x-2.4.

If/when I do get it working, will it be possible to multiply by negative amounts? Say if I wanted an attribute to give a 10% discount when selected.

Thanks!

lauraatamysragbag's picture
Offline
Joined: 02/24/2010
Juice: 68
trying to revert to original attripute module

I tried the patch and it didn't work for me. Today I tried to revert back to the original attributes module. I disabled ubercart, reinstalled, enabled, and ran update.php I got this error:

user warning: Table 'amys9174_drpl1.uc_attributes' doesn't exist query: SELECT upa.aid FROM uc_product_attributes AS upa LEFT JOIN uc_attributes AS ua ON upa.aid = ua.aid WHERE upa.nid = 7257 ORDER BY upa.ordering, ua.name in /home/amys9174/public_html/sites/all/modules/ubercart/uc_attribute/uc_attribute.module on line 612.

I've tried update.php, cron, clear cache, and repair database in MySql. Does anyone have any idea how I can bring the table into existence? Thanks!

Jedediah Smith's picture
Offline
Joined: 07/07/2010
Juice: 25
Recovering After removing

Have you looked at your database to see if your uc_attributes table still exists? If it does you could try removing disabling the uc_attributes module and then remove the whole table manually and then reinstall the uc_attributes module. If the table is missing I would try disabling the uc_attributes module, uninstalling it, and then reinstalling the module again afterwards.

To get the patch to work you have to modify the database as mentioned in my initial post. My updated patch doesn't modify the database or the .install file so updating the database has to be done manually. If you made the changes manually you will have to remove them manually. This can be done by running something like:

ALTER TABLE `uc_attribute_options` DROP COLUMN `multiplier`;
ALTER TABLE `uc_class_attribute_options` DROP COLUMN `multiplier`;
ALTER TABLE `uc_product_options` DROP COLUMN `multiplier`;

Along with fixing the database you only need to replace the uc_attributes.module file (and uc_attributes.install if you used by original patch) with the originals and it should be back to normal, you should not have to run the update.php.

If you used my original patch which modified the uc_attributes.install file you could have removed the changes in the database by uninstalling the uc_attributes module. Disabling the uc_attributes module will not remove the changes (in fact it will do nothing to the database), in Drupal you have to uninstall a module to remove the references in the database. So disable the uc_attributes and then uninstall it the replace the uc_attributes files with the original and enable it and you should be good to go.

Jedediah Smith
Online By Design LLC

lauraatamysragbag's picture
Offline
Joined: 02/24/2010
Juice: 68
Re: Recovering After removing

Thanks for your help. It turned out that I had a duplicate modules directory with all the modules duplicated in there, so that was the source of the problem. Definitely not the fault of the patch! I would try it again, but I've got the Custom Price Calculation module set up now.

Jedediah Smith's picture
Offline
Joined: 07/07/2010
Juice: 25
Negatives

To give a discount you do not use negative numbers. This module so I could give a percentage discount. However, I wasn't trying for user friendliness just a simple get it to work approach. So if you want to give a discount you use a multiplier less then 1. For example for a 10% discount you would use .9 (10% equals .1 so 1 - .1 = .9). If you wanted to increase the price by 10% you would enter 1.1 (1 + .1 = 1.1).

Jedediah Smith
Online By Design LLC

lauraatamysragbag's picture
Offline
Joined: 02/24/2010
Juice: 68
Re: Negatives

Thanks, that makes sense!

lapongua's picture
Offline
Joined: 10/31/2011
Juice: 3
Hi Jedediah! I try this patch

Hi Jedediah!

I try this patch for Ubercart 2.6 and doesn't work. It's only for Ubercart 2.4? Thanks.

ndvo's picture
Offline
Joined: 08/15/2010
Juice: 8
You are right

Thank you.

Nikhil Goyal's picture
Offline
Joined: 07/13/2010
Juice: 16
#17 works

I just tested the patch by Jedediah Smith and it worked for me, I created two attributes and one attribute has semi-annual and annual as the option, the other attribute has just different product with different pricing and it worked well, no errors for now.

Thanks for the patch !!

Jedediah Smith's picture
Offline
Joined: 07/07/2010
Juice: 25
Glad it works

It is good to hear that so far at one has had any problems. It probably needs more of a description with the multiplier but I was not sure how I could put it so that it is it easy to understand what the multiplier does.

Jedediah Smith
Online By Design LLC

Nikhil Goyal's picture
Offline
Joined: 07/13/2010
Juice: 16
Re: Glad it works

It should be certainly added to the next release, even applying the patch was breeze.

rafagadeviento's picture
Offline
Joined: 08/13/2010
Juice: 32
thanks!

Hi Jedediah , thanks for the patch, this solves one big issue for me Smiling.

thedecline's picture
Offline
Joined: 10/26/2008
Juice: 44
Re: Price adjustments by multipliers

Is there any chance this would get included in the next 2.5 release?

its a great patch and really very powerful.

baff's picture
Offline
Joined: 07/31/2010
Juice: 29
Core feature

Does this become part of Ubercart package?

whatifif's picture
Offline
Joined: 07/29/2011
Juice: 5
Adjustment of the formular for the item price with multipliers

Hi Jed,

I adjusted the price-calculation formular so that the pricing is flexble to be applied for most cases.
In this price calculation, the final price is caculated as follows:

$item->price= ($item->price + (accumulated $option[price]) )*(accumulated $option[multiplier])

This logic can be applied for many useful cases:
1. if $option[price]) is given and $option[multiplier] is set to 0 or 1 , then this logic performs the original price caculation. All option prices are just added to item price.

2. if $option[price]) is set to 0 and $option[multiplier] is not 0, then this logic perform the original price times the accumulated $option[multiplier]. This can be applied to $/Kg * Kg type pricing system like pricing meat or milk by weight or volume.

3. if $option[price]) is not 0 and $option[multiplier] is not 0, then this logic performs each option's contribution to the final price. Any option can affect the final price by way of each option's price and each option's multiplier.

Notice the 3 adjusted line:
1. $op_multiplier = 1;// this is set to 1 initially.
2. $op_multiplier *= $option['multiplier'];//$op_multiplier is accumulated
3. $item->price = $op_prices*$op_multiplier;// final $item->price is multiplied by accumulated $op_multiplier

Here I attached my adjusted function.

function uc_attribute_cart_item($op, &$item) {
switch ($op) {
case 'load':
$options = _uc_cart_product_get_options($item);

$op_costs = 0;
$op_prices = $item->price;
$op_weight = 0;

// this is set to 1 initially
$op_multiplier = 1;

foreach ($options as $option) {
$op_costs += $option['cost'];
$op_prices += $option['price'];
if ($option['multiplier'] < 0 || $option['multiplier'] > 0) {
//$op_prices = $op_prices * $option['multiplier'];

//$op_multiplier is accumulated
$op_multiplier *= $option['multiplier'];
}
$op_weight += $option['weight'];
}
$item->cost += $op_costs;
//$item->price = $op_prices;

// final $item->price is multiplied by accumulated $op_multiplier
$item->price = $op_prices*$op_multiplier;
$item->weight += $op_weight;

$combination = array();
foreach ((array)$item->data['attributes'] as $aid => $value) {
if (is_numeric($value)) {
$attribute = uc_attribute_load($aid, $item->nid, 'product');
if ($attribute && ($attribute->display == 1 || $attribute->display == 2)) {
$combination[$aid] = $value;
}
}
}
ksort($combination);

$result = db_query("SELECT model FROM {uc_product_adjustments} WHERE nid = %d AND combination LIKE '%s'", $item->nid, serialize($combination));
$model = db_result($result);

if (!empty($model)) {
$item->model = $model;
}
break;
}
}

ktf
ktf's picture
Offline
Joined: 06/22/2009
Juice: 84
Re: Price adjustments by multipliers

Has anyone been able to apply this patch successfully to Ubercart 2.6? I'm getting a lot of "Hunk #x FAILED" messages. I'd like to upgrade, but my site depends on the multiplier functionality.

Any help appreciated!

alfthecat's picture
Offline
Joined: 06/11/2010
Juice: 14
Offering $ for help with this

Hi,

I've tried the patch but for some reason it failed, producing errors:

-bash-3.2# patch -p0 < multiplier.patch
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -urp uc_attribute/uc_attribute.admin.inc /home/jsmith/Downloads/drupal/ubercart_mod/uc_attribute/uc_attribute.admin.inc
|--- uc_attribute/uc_attribute.admin.inc 2010-07-11 19:33:31.000000000 -0600
|+++ /home/jsmith/Downloads/drupal/ubercart_mod/uc_attribute/uc_attribute.admin.inc 2010-08-17 09:37:28.716809308 -0600

I'm not really sure if this patch solves the entire issue for me, for I need some calculating flexibility enhancements to the ubercart price adjustments through attributes. Subsequently, I've posted the following on the Drupal payed support forum. Perhaps anyone here is interested? My post is here: http://drupal.org/node/1266948
Hope to hear from you!

I'm looking for someone to develop a module to enhance the Ubercart attribute price adjustment options. I'm confident a lot of others would be interested in this, and I'd love for the module to be contributed back here.

The issue is this:
When creating an attribute, one can only specify a price adjustment in the form of an increase to the price of a product. This makes it impossible to calculate costs based on dimensions, for instance. If you sell cloths, then the price should be width * height * sell price. Currently this appears to not really be possible with Ubercart.

An alternative to this is http://drupal.org/project/uc_custom_price in addition with http://drupal.org/project/uc_attribute_tokens.
There are two downsides to that approach. 1 - It works with a new input field on the product node form, where one needs to write blocks of php code. This is not suitable for most end users. 2 - it isn't compatible with http://drupal.org/project/uc_aac (or so I believe). Both of these components are a requirement for me.

To summarize, I'm looking for a module that (perhaps using the concept of uc_attribute_tokens) allows for a calculation to be entered into the attribute option's price adjustment field, and perhaps specifically also adds a width x height attribute. So the input could be provided in the form of a simple formula, like this:
Add attribute --> [name] --> add option [height x width] --> price adjustment (user input)--> (([width] * [height])/100) * [price] - [price]

Or

Add attribute --> [name] --> add option [calculation] --> price adjustment (user input) --> [width] * 0.3 * [price]

etc.

I hope this can be done in some way, I think there are some parts that can be used already. I found a patch in the Ubercart forum to allow for a multiplier adjustment, but the patch produced many errors on my site. However, it may be a valuable starting point: http://www.ubercart.org/forum/ideas_and_suggestions/4582/price_adjustmen...

Also, the attribute tokens (http://drupal.org/project/uc_attribute_tokens) appear to be another useful building block. In addition, the custom price calculations also seems to get very close. What I need however, is the three to come together and provide the much desired funtionality of using attribute price adjustments based on price, other attributes and simple (Excel like) formula inputs.

Looking forward to any replies!

relocksmith (not verified)
relocksmith's picture
Price adjustments by multipliers

We believe your work, and article, are wonderful.

Plato1123's picture
Offline
Joined: 10/02/2010
Juice: 60
Re: Price adjustments by multipliers

Anyone know when and if this might make it into the ubercart main package?
Thanks,
Patrick

Plato1123's picture
Offline
Joined: 10/02/2010
Juice: 60
Re: Price adjustments by multipliers

For those of you who are confounded like I was, Jebediah's patch in #22 seems to work great, at least with ubercart 2.4.

Patching the files threw me for a loop. After much duress here's what I did to get it to work:
1) installed a copy of cygwin that included the patch.exe command line patcher. This one should work: http://sourceforge.net/projects/gnuwin32/files/patch/2.5.9-7/patch-2.5.9...
2) Opened a command prompt on my windows machine (start -> "cmd")
3) Navigated to the folder where my ftp client had downloaded the ubercart attribute files... at the command prompt type in something like cd \website\public_html\sites\all\modules\ubercart\uc_attribute
Once you're in the right folder when you type "dir" you should see the files uc_attribute.admin.inc and uc_attribute.module
4) Edit the patch file provided by jebediah in #22 to fix file paths. In Jebediah's patch file he has the path "/home/jsmith/Downloads/drupal/ubercart_mod/uc_attribute/"... I used a text editor to search and replace for that file path with nothing, so in effect I removed the path to file and left the file names. Since we're changing to the folder where these files are stored we do not have to specify the file path. Line 3 of his patch file changed from
+++ /home/jsmith/Downloads/drupal/ubercart_mod/uc_attribute/uc_attribute.admin.inc 2010-08-17 09:37:28.716809308 -0600
to
+++ uc_attribute.admin.inc 2010-08-17 09:37:28.716809308 -0600
Note there are several places in this patch file that specifies this path so it's best to do a search and replace. I used dreamweaver to do this but any text editor should work.
5) back to command prompt, type the command:
c:\cygwin\bin\patch.exe -p0 < c:\multiplier.patch
^note that the first portion is the location of the patch.exe file (wherever you installed it), the second portion is the location of the patch file (that I saved to c:\ in my case) and the current folder needs to be where uc_attribute.admin.inc and uc_attribute.module are located.
If you executed this correctly you should see a message "patching file uc_attribute.admin.inc
patching file uc_attribute.module". Replace these two files on the server with the patched versions (if you're not doing this on the server itself).

Once installed you can see the Drupal options at /admin/store/attributes/option
Clicking on options and then edit takes you to a path like this /admin/store/attributes/2/options/8/edit where you should see a new option "Multiplier"

Hope this helps someone!!

Plato1123's picture
Offline
Joined: 10/02/2010
Juice: 60
Re: Price adjustments by multipliers

Just a quick heads up, I discovered on one of our sites the attributes no longer worked after installing this patch. I can't be 100% sure this patch was responsible but it seemed pretty likely. We fixed by upgrading to ubercart 2.6 (overwriting the patching we had done). Just wanted to give you a heads up.

hockey2112's picture
Offline
Joined: 05/06/2012
Juice: 176
Re: Price adjustments by multipliers

Was this type of functionality ever rolled into core, or made into a contrib module? I'm a little hesitant to hack my core ubercart files...

choofieblankets's picture
Offline
Joined: 08/01/2013
Juice: 3
Re: Price adjustments by multipliers

Great!

Mattster's picture
Offline
Joined: 10/29/2013
Juice: 9
D7.23 and Ubercart 2.5 version

I was able to get multipliers to work for the current D7.23 and Ubercart 2.5 version.
Not by patching directly of course. It looks like the patch has some leftover lines from the developers version anyway (perhaps this is why it failed for some people).
But by reading the patch file and then going on to the uc_attribute files to update them with some thinking wherever the price field occurred. I was even able to handle some total/adjustment price issues and them even got separate cost/price multipliers. The code is pretty self-understood. It worked immediately, so it was not too difficult. Hope this helps someone find the best way to get this going.