Post by ryan62383 » Tue Jan 01, 2013 11:43 am

Hello,

I found a problem with this.

I have a product that has a required option called Amount: with other prices listed.
its regular cost is $39.95.
The first option is the regular price with a option price of +0.00 When this option is chosen the price displayed is double.
Second option might be 69.95 with a option price of +30.00 this works correctly by adding the regular price to the $30.00.

It only does this on products with prices that don't end in .00

I am about to start learning javascript and don't know how it works quite yet. Any Idea's would be greatly appreciated.

I can send a link where you can demo what is happening if needed.

This problem can be avoided by making the option not required but I would like people to know there are different price they can purchase before just adding it to the cart.

Newbie

Posts

Joined
Fri Jun 17, 2011 12:57 am

Post by ryan62383 » Tue Jan 01, 2013 1:31 pm

Ok I found a fix for this issue.

catalog\controller\product\product.php around line 255 I changed this

Code: Select all

} else {
	$price = false;
}
To this

Code: Select all

} else {
	$price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
}

Newbie

Posts

Joined
Fri Jun 17, 2011 12:57 am

Post by ryan62383 » Wed Jan 02, 2013 2:21 am

Ok so the above fixes the 1st problem but creates a new one.

Now I have options that have nothing to do with price and they show (+$0.00) which just doesn't look right

Newbie

Posts

Joined
Fri Jun 17, 2011 12:57 am

Post by Mystica » Tue Jan 29, 2013 3:03 am

hi there,
i just isntalled Version 1.5.5.1 and it seems this hack is not working
simply the price doesn't update
and news about that?
thanks!

Newbie

Posts

Joined
Tue Apr 15, 2008 1:55 am

Post by erelnet » Wed Jan 30, 2013 2:08 am

Could anyone find a solution for radio option?

Thanks.

Newbie

Posts

Joined
Fri Nov 30, 2012 2:46 am

Post by erelnet » Wed Jan 30, 2013 3:09 am

Ok just found, if you want radio selection instead of dropdown style,

First in product.tpl find the section

Code: Select all

<?php if ($option['type'] == 'radio') { ?>
        <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
          <?php if ($option['required']) { ?>
          <span class="required">*</span>
          <?php } ?>
          <b><?php echo $option['name']; ?>:</b><br />
          <?php foreach ($option['option_value'] as $option_value) { ?>
          <input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
          <label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
            <?php if ($option_value['price']) { ?>
            (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
            <?php } ?>
          </label>
          <br />
          <?php } ?>
replace this with

Code: Select all

<?php if ($option['type'] == 'radio') { ?>
			<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
			  <?php if ($option['required']) { ?>
			  <span class="required">*</span>
			  <?php } ?>
			  <b><?php echo $option['name']; ?>:</b><br />
			  <?php foreach ($option['option_value'] as $option_value) { ?>
			  <input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>"/>
			  <label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
				<?php if ($option_value['price']) { ?>
				
				(<?php echo $option_value['price_prefix']; ?><span id="newPrice"><?php echo $option_value['price']; ?></span>)
				
				<?php } ?>
			  </label>
			  <br />
			  <?php } ?>
			</div>
			<br />
			<?php } ?>
Then make these changes in Javascript code (header.tpl):

Code: Select all

   $('.option').change(function() {
   var OriginalPrice = $('#thisIsOriginal').text();
   var OriginalCurrency = OriginalPrice.substring(0, 1);
   OriginalPrice = OriginalPrice.substring(1);
   OriginalPrice = OriginalPrice.replace(",","");
   var newPriceValue = $('.option :selected').text();
with this

Code: Select all

   $('input:radio').change(function() {
   var OriginalPrice = $('#thisIsOriginal').text();
   var OriginalCurrency = OriginalPrice.substring(0, 1);
   OriginalPrice = OriginalPrice.substring(1);
   OriginalPrice = OriginalPrice.replace(",","");
   var newPriceValue = $('input:radio:checked').next().text();
Works for me, I'm using OC v1.5.4

Glad if I could be help...

Newbie

Posts

Joined
Fri Nov 30, 2012 2:46 am

Post by daleharris » Fri Feb 22, 2013 9:00 pm

Hi guys, I have tried to add this to a site I am working on at the moment and would appreciate someone taking a look at it as I can't work out what I have done wrong.

http://www.thequircus.com/store/lemasqueradeprint

Newbie

Posts

Joined
Fri Feb 22, 2013 8:58 pm

Post by parvez » Fri May 17, 2013 4:28 pm

when i am price £1.10
come to only £1
and when itemprice .50 come to only £0

any one no why come like

Newbie

Posts

Joined
Fri May 17, 2013 4:26 pm

Post by ooleonoo » Tue May 28, 2013 2:31 am

http://www.opencart.com/index.php?route ... n_id=11730

1 - Live Update Product Price,
2 - Option = * / +% -% + - Price Module,
3 - Enter percents for discounts and specials.

Newbie

Posts

Joined
Sun Apr 07, 2013 9:52 pm

Post by Alchazar » Tue Jan 07, 2014 3:27 pm

Hi,
I found nice and working vqmod extension for price update on option or quantity change. It's from russian opencart forum and some comments in code are in russian - http://opencartforum.ru/files/getdownlo ... jax-vqmod/

Attachments

Autocalc_price_option


Newbie

Posts

Joined
Tue Jan 07, 2014 3:19 pm
Location - Lithuania

Post by dlovin123 » Thu Mar 13, 2014 12:34 am

This mod does work but not in conjuction with a conflicting mod I am running.

We are running Options Boost - http://www.opencart.com/index.php?route ... on%20boost

Option Boost lets us set the options as "This Option = $This Price" instead of having to do math and figure out the +$markup for each product. Saves us tons of time with setup and updating pricing.

The mod was changing the displayed price but it was breaking. It was going back to $0.00 for options that didn't give a price increase, and options that did give an increase it would only go back up to the original base price.

Any thoughts?

Newbie

Posts

Joined
Wed Mar 12, 2014 12:14 am

Post by mark89769 » Fri Mar 28, 2014 12:48 am

Thanks for the share, @dlovin123 check your vqmod log and post it here.

Newbie

Posts

Joined
Mon Oct 29, 2012 6:43 pm

Post by php_dipak » Fri Aug 22, 2014 4:46 pm

Hey guys
here is what i have implemented. Please have a look at let me know if any one require assistance with the code.
http://demo1.tecz.com/opencart/index.ph ... duct_id=42

Newbie

Posts

Joined
Fri Aug 22, 2014 4:43 pm

Post by sandy1990 » Tue Dec 02, 2014 6:00 pm

Hello,

I am using this script but this script is not working well at our end .I am adding this script but after the update of first option we get "RNAN" error. Please help as soon as possible.

Newbie

Posts

Joined
Tue Dec 02, 2014 5:56 pm

Post by sandy1990 » Tue Dec 02, 2014 9:35 pm

Hello,

I have used this script in my site but after the changing of weight option. We get "RNAN" error and doesn't change the updated price. Please help as soon as possible.

Thanks

Newbie

Posts

Joined
Tue Dec 02, 2014 5:56 pm

Post by Zigy » Wed Jan 14, 2015 8:13 pm

php_dipak wrote:Hey guys
here is what i have implemented. Please have a look at let me know if any one require assistance with the code.
http://demo1.tecz.com/opencart/index.ph ... duct_id=42
Hey php_dipak. I love what you've done and am trying to do something very similar. Would love to know how you did it.

Newbie

Posts

Joined
Wed Jan 14, 2015 6:33 pm

Post by BBST » Fri Apr 24, 2015 3:37 pm

How can i auto update the price on option change in opencart version 1.5.6.4

Newbie

Posts

Joined
Fri Apr 24, 2015 3:26 pm

Post by fokz8 » Fri Aug 21, 2015 6:33 pm

can any1 help with this on opencart 2.0.2.0 ?

New member

Posts

Joined
Sun Jul 26, 2015 8:35 pm

Post by FaizanJ » Thu Jan 28, 2016 8:12 am

fokz8 wrote:can any1 help with this on opencart 2.0.2.0 ?
i am using opencart 2.0.3.1 and after the product.tpl changes i have just come up with the following code to make it work with check boxes and radio buttons as well ;)
in their code:

Code: Select all

$('.option').change(function() {

replace this with:

Code: Select all

$('#product input,#product select').change(function() {
and

in their code where

Code: Select all

var newPriceValue = $('.option :selected').text();
replace this with:

Code: Select all

if($('input.radiooption:checked').closest("label").text()!=''){
		var radioPrice=$('input.radiooption:checked').closest("label").text();
	}
	if($('.option :selected').text()!=''){
		var selectPrice=$('.option :selected').text();
	}
	if($('input.checkboxoption:checked').closest("label").text()!=''){
		var checkboxPrice=$('input.checkboxoption:checked').closest("label").text();
	}
	 var newPriceValue = selectPrice+radioPrice+checkboxPrice;
its working great on my side

;) ;) ;)

Newbie

Posts

Joined
Thu Jan 28, 2016 8:06 am

Post by s3eed » Wed Nov 27, 2019 3:11 am

can anyone help me my site work 3.0.3.1 ?
thanks

New member

Posts

Joined
Thu Apr 19, 2018 5:21 pm
Who is online

Users browsing this forum: No registered users and 29 guests