Post by lemongrass » Tue Dec 22, 2009 8:17 am

Hi!

I am setting up my first store with Opencart and was wondering if it was possible to change the way `option pricing' displays.

In the drop down choice box instead of it sayinf

Option 1 - $5.00
Option 2 + $10.00

if it's possible to say the actual price

Option 1 $47.00
Option 2 $62.00 etc?

Also, I have read other posts regarding this, and was wondering if anyone had a solution:
Having different images for different options, so if the default option was short sleeve short and the customer chose long sleeve shirt the image would change to the long sleeve shirt image (like I think PrestaShop does!).

Thanks
Ernie

Newbie

Posts

Joined
Tue Dec 22, 2009 8:12 am

Post by Qphoria » Tue Dec 22, 2009 8:54 am

1. EDIT: catalog/controller/product/product.php

2. FIND (~line 220):

Code: Select all

$option_value_data[] = array(
    'option_value_id' => $option_value['product_option_value_id'],
    'name'            => $option_value['name'],
    'price'           => (float)$option_value['price'] ? $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))) : FALSE,
    'prefix'          => $option_value['prefix']
);
3. REPLACE WITH:

Code: Select all

 $option_value_data[] = array(
            			'option_value_id' => $option_value['product_option_value_id'],
            			'name'            => $option_value['name'],
            			'price'           => (float)$option_value['price'] ? $this->currency->format($this->tax->calculate($option_value['price']+$product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))) : FALSE,
            			'prefix'          => ''
          			);

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by steamcrow » Wed Dec 23, 2009 6:43 am

Thanks for this fix!

This is how I was expecting OC to work, and I'm glad that your answer got it working right. Works like a charm.

Note to newbs like me: Remember that your other prices will be effected by the base price. So you'll need to adjust your other prices off of the base one. Play around, and you'll get it right.

Daniel M. Davis

[url=http://www.steamcrow.com]

http://www.twitter.com/steamcrow


New member

Posts

Joined
Sun Aug 16, 2009 4:18 am

Post by steamcrow » Wed Apr 14, 2010 10:12 pm

Any idea how one would do this in 1.4.7?

I tried the old way, but it killed my product pages.

Daniel M. Davis

[url=http://www.steamcrow.com]

http://www.twitter.com/steamcrow


New member

Posts

Joined
Sun Aug 16, 2009 4:18 am

Post by Qphoria » Wed Apr 14, 2010 11:14 pm

Just replace the price line from that first block:

Code: Select all

'price'           => (float)$option_value['price'] ? $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))) : FALSE,
And set the prefix to ''

Code: Select all

'prefix'          => ''

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by jfn99 » Sat Apr 17, 2010 12:34 am

How do I make this to work with the OPTION PRICE UPDATE http://www.unbannable.com/ocstore/openc ... ice_update

I'm using OC 1.4.6
right now the Price wont update the full cost of options.
is it possible?

also how to show price on items +$0
How do I make the normal cost to show on the options

thanks

New member

Posts

Joined
Thu Feb 25, 2010 5:14 pm

Post by ausgabru » Sun May 30, 2010 12:15 am

This is a great way to do it.

The only problem I've got is it only works when the price is being added to the base price.

When you subtract the price and the prefix is " - " it still shows the price as added to the base price in options dropdown although it shows the correct price in checkout.

How do you make it work so it shows the correct price in the options dropdown when the price is being subtracted from the base price?

Thanks

Newbie

Posts

Joined
Sun May 30, 2010 12:03 am

Post by smorelli » Tue Jul 13, 2010 11:20 pm

Seems to be an issue in 1.4+ versions. I'm getting the same problem. Do you have this figured out yet?

New member

Posts

Joined
Wed Jan 27, 2010 6:28 am

Post by Moggin » Sun Jul 18, 2010 7:47 am

For some of my product options, the default price is the mid-price. The lowest priced item is an add-on item.

So product options look strange, as selecting a £17 item shows: e-booklet -£31.00. I'm doing a double take trying to figure out the price, and so will the customers :)

I've seen these fixes, and this one would do well:
Qphoria wrote:1. You can fake it.
Instead of +2.00 you can change it to show the actual price
Product Price: 10.00
option 1: 12.00
option 2: 15.00
The problem here is that it could be confusing unless you are using an auto-update script like my Option Price Update.
...I DO use Qphoria's Options Price Update, and I understand from this thread that the fix shown here won't work with it?

So, how would I apply this fix, and have it work with Options Price Update? If necessary, NO price display will be OK too, since this is in the description - & the Updater shows it anyway.

I'm using 1.4.8b. If I've missed something, please point me at it. Thanks!

Active Member

Posts

Joined
Wed May 05, 2010 4:56 am

Post by smorelli » Wed Aug 25, 2010 6:30 am

*Bump

Is there a solution to this for 1.48?

New member

Posts

Joined
Wed Jan 27, 2010 6:28 am

Post by karlos » Thu Nov 04, 2010 8:49 pm

lemongrass wrote:Hi!

I am setting up my first store with Opencart and was wondering if it was possible to change the way `option pricing' displays.

In the drop down choice box instead of it sayinf

Option 1 - $5.00
Option 2 + $10.00

if it's possible to say the actual price

Option 1 $47.00
Option 2 $62.00 etc?

Also, I have read other posts regarding this, and was wondering if anyone had a solution:
Having different images for different options, so if the default option was short sleeve short and the customer chose long sleeve shirt the image would change to the long sleeve shirt image (like I think PrestaShop does!).

Thanks
Ernie

hello
now i am in the same point but ..... i have some think more to ask ....

option 1 $47.00 reference A1
option 2 $62.00 reference A2

is not the same reference one ippod 1gb or the same ippod 8 gb

how can i have individual reference for the diference options in product ???

thanlk

New member

Posts

Joined
Fri Sep 10, 2010 9:47 pm

Post by Alobeta » Wed Dec 01, 2010 8:30 pm

bump. any update for this in 1.4.9 ?

Newbie

Posts

Joined
Wed Nov 10, 2010 7:58 pm

Post by hmdadou » Wed Dec 08, 2010 6:48 pm

Does anyone knows how to turn off the prefix in module Options plus, I wanted to show only the full price.
any help will be greatly appreciated.

Newbie

Posts

Joined
Sun May 02, 2010 6:04 pm

Post by Quilly » Sun Jan 30, 2011 7:59 am

im looking to accomplish the same thing. Has anyone had any luck with this? Any help would be greatly apreciated

Newbie

Posts

Joined
Sun Jan 30, 2011 7:58 am

Post by trapson » Thu Feb 03, 2011 6:23 pm

looking also for this to work in recent version of opencart
[edit]
changed prefix and price to ' ' and now it does not show both so it works for me.
Last edited by trapson on Sat Feb 05, 2011 5:44 pm, edited 1 time in total.

Opencart 1.4.9.3


New member

Posts

Joined
Fri Sep 24, 2010 7:10 pm

Post by Qphoria » Sat Feb 05, 2011 1:45 pm

This has not changed since my original post..not sure why people keep asking for an update.. this code works the same in the latest version of opencart

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by MattW » Fri May 06, 2011 6:39 pm

I've made this change on to one of my shops running 1.4.9.4 and it works exactly as described.

Image


User avatar
New member

Posts

Joined
Sat Aug 28, 2010 11:37 am
Location - Sheffield

Post by 3bsc.it » Fri Jul 29, 2011 5:29 am

in OpenCart 1.5.1

1. EDIT: catalog/controller/product/product.php

2. FIND (~line 253):

Code: Select all

foreach ($option['option_value'] as $option_value) {
						if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
							$option_value_data[] = array(
								'product_option_value_id' => $option_value['product_option_value_id'],
								'option_value_id'         => $option_value['option_value_id'],
								'name'                    => $option_value['name'],
								'price'                   => (float)$option_value['price'] ? $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))) : false,
								'price_prefix'            => $option_value['price_prefix']
							);
						}
					}
3. REPLACE WITH:

Code: Select all

foreach ($option['option_value'] as $option_value) {
						if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
							$option_value_data[] = array(
								'product_option_value_id' => $option_value['product_option_value_id'],
								'option_value_id'         => $option_value['option_value_id'],
								'name'                    => $option_value['name'],
								'price'                   => (float)$option_value['price'] ? $this->currency->format($this->tax->calculate($option_value['price']+$product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))) : false,
								'price_prefix'            => ''
							);
						}
					}

Image


User avatar
Newbie

Posts

Joined
Thu Jul 28, 2011 11:53 pm


Post by jaxpa » Fri Aug 05, 2011 9:26 am

Hey folks, found this fix and it works almost perfectly.

I have found that this will only work correctly if the price option variation is a positive (ie set to increase the price), as the code is set to always add the value.

eg, If the main products price is $20.00, and the price option is set to -$5.00 the desired price should be shown as $15, but will shown as $25.00, even though the correct price shows in the cart if added.

I made a small addition to the alteration as seen here:

Code: Select all

	foreach ($option['option_value'] as $option_value) {
		
		if($option_value['prefix'] == '-'){
			$option_value['price'] = 0 - $option_value['price'];
		}
	
		
		$option_value_data[] = array(
			'option_value_id' => $option_value['product_option_value_id'],
			'name'            => $option_value['name'],
			'price'           => (float)$option_value['price'] ? $this->currency->format($this->tax->calculate($option_value['price']+$product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))) : FALSE,
			'prefix'          => $option_value['prefix']
		);
	}
What this checks for is the prefix and then alters the price value to be a negative if the prefix is '-', if the prefix is '+" then no change is made.

Technically the number is still added, but as it is now a negative the end result is that the correct price is shown.

It's a bit crude, and there may be a more elegant way of working this out, but hopefully it comes in handy for someone.

Newbie

Posts

Joined
Tue Jan 19, 2010 6:28 am

Post by emkla » Thu Sep 08, 2011 5:33 am

Need to bump this..

So wich of the above codes should i use if i want this:

Product A - Price $10 - Option
Size 1(Current)
Size 2 = $5

Don't want +/-, because then the customer will have to sit with a calculator to figure out the prize of option size 2 wich is kinda stupid.

Please help!

Newbie

Posts

Joined
Wed Aug 31, 2011 10:50 pm
Who is online

Users browsing this forum: No registered users and 124 guests