Try the Demo

Magento

eCommerce Software for Online Growth

Magento Forum

Our new hosted solution for small & emerging businesses
   
Page 2 of 3
Absolute Pricing for Custom Options (one time charge)
 
smg1965
Jr. Member
 
Total Posts:  15
Joined:  2009-03-30
 
cevans73 - 21 September 2009 02:17 PM

Hey Sean,

Can you be a little more specific on the first part, for the code in product.js......do we replace code?  or are we adding this code after code that is already there?  I can’t find similar code on the line you provided, just need more specifics on what to do with the code you provided....

Thanks!

Chris

This seems to go here (example from one of Sean’s sites I found). But caused the price not to change when selecting radio button options so didn’t use!

Can’t believe this isn’t standard in Magento!
Don’t believe the hype!

price optionPrices+parseFloat(_productPrice);
                        
}
                    }
                }


//alert(optionPrices);
//alert(_productPrice);
//alert(price);

// Fix by Sean Breeden
// InteractOne, Inc.

        
var abs_or_fixed document.getElementById('absorfixed').innerHTML;

        if (
abs_or_fixed=="ABS"

                price 
optionPrices;

        
else {
            
                price 
optionPrices+parseFloat(_productPrice);
        
}
                
// end of fix

                
if (price 0price 0;

 
Magento Community Magento Community
Magento Community
Magento Community
 
smg1965
Jr. Member
 
Total Posts:  15
Joined:  2009-03-30
 
dd_gi - 10 October 2009 07:44 AM

I’ve been following this thread, I don’t think I’ve responded yet but I would like more specific information about what exactly is needed here, likely a solution can be provided.

An update for the latest version of Magento for this ‘Absolute’ price fix in the Wiki http://www.magentocommerce.com/wiki/how-to/use-absolute-price-for-custom-options, but ultimately it’s incorporation in future releases and updates of Magento.

This should be standard functionality!

 
Magento Community Magento Community
Magento Community
Magento Community
 
jjafuller
Jr. Member
 
Total Posts:  17
Joined:  2008-03-24
 

Alright, I know you guys have been coming up with a variety of solutions, but they all involved editing core files, which I am not a huge fan of, so I whipped up a quick script to resolve the presentation issue on my end. Obviously, it isn’t philosophically pure since I just whipped it together in jquery. And, it would be more appropriate as a prototype script. Hopefully someone finds this helpful.

First, you’ll want to include jquery, if you haven’t already. I just use google’s cdn.

So, in your head file:

/app/design/default/[theme-name]/template/page/html/head.phtml

Below this line:

<link rel="shortcut icon" href="<?php echo $this->getSkinUrl('favicon.ico') ?>" type="image/x-icon" />

I added:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>

In the following file:

/app/design/default/[theme-name]/template/catalog/view/view.phtml

Below this line:

var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);

I added the following:

// clear out the built in refresh
    Product.Config.prototype.reloadOptionLabels = function(element{ };
    
    
// quickly throw together a basic currency formatter
    
function FormatCurrency(amount)
    
{
      
var parseFloat(amount);
      if(
isNaN(i)) { i 0.00}
      
var minus '';
      if(
0{ minus '-'}
      i 
Math.abs(i);
      
parseInt((.005) * 100);
      
100;
      
= new String(i);
      if(
s.indexOf('.') < 0{ s += '.00'}
      
if(s.indexOf('.') == (s.length 2)) { s += '0'}
      s 
minus s;
      return 
s;
    
}
    
    
// replace all prices with absolute prices
    
function absoluteOptionPrices()
    
{
      
var price jQuery('.price-box span span:last').html().split('$').pop();
      
      
jQuery('#product-options-wrapper option').each(function(i){
        
var name jQuery(this).html();
        var 
nodes name.split('+$');

        if (
nodes[1] 0)
        
{
          
var value FormatCurrency(parseFloat(price) + parseFloat(nodes[1]));
          
jQuery(this).htmlnodes[0] ' - $' value);
        
}
      }
);
    
}
    
    
// initialize everything
    
jQuery(document).ready(function(){
      
var base_price jQuery('.price-box span span:last').html();
      
      
absoluteOptionPrices();
      
      
// update price on change
      
jQuery('#product-options-wrapper select').change(function(){
        
var price jQuery(this).children('option:selected').html().split(' - ').pop();
        if(
price[0]=='$')
        
{
          jQuery
('.price-box span span:last').html(price);
          
jQuery('.product-price span').html(price);
        
}
        
else
        
{
          jQuery
('.price-box span span:last').html(base_price);
          
jQuery('.product-price span').html(base_price);
        
}
      }
);
    
});

 
Magento Community Magento Community
Magento Community
Magento Community
 
kathstevens
Jr. Member
 
Total Posts:  1
Joined:  2009-10-26
 

Great thread. This is why I really love this thread. People here are so helpful and has good ideas. Thanks for sharing and helping..

regards,
kathleen
Simulation prêt

 
Magento Community Magento Community
Magento Community
Magento Community
 
mediagang
Sr. Member
 
Avatar
Total Posts:  111
Joined:  2008-01-17
Leeds UK
 

Hi jjafuller,

I’m following your instructions but cannot get it to work (Magento ver. 1.3.2.4)

Can you please confirm the step:

In the following file:

/app/design/default/[theme-name]/template/catalog/view/view.phtml file?

Did you mean:

/app/design/default/[theme-name]/template/catalog/product/view.phtml file

Do you have any other advice you can offer?

 Signature 

UK Magento Services
Solar Gadget Store : Catering Equipment : Guerrilla Marketing

 
Magento Community Magento Community
Magento Community
Magento Community
 
merigold
Sr. Member
 
Total Posts:  207
Joined:  2009-04-22
 

Hi,

I follow the solutions provided for calculation with Absolute value. But still not work for me in magento 1.3.1 version. I am working with bundle products and they has selection box for choosing options. By selecting the option the price should change and my requirement is to have one absolute value in which this optional price will add. just like http://www.duetinteriorcollections.com/index.php/for-the-table/tablecloths-and-table-runners/venice-hem.html discussed in this thread.

Can i get help for the step by step absolute value adding in such application?

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
dfischer
Jr. Member
 
Avatar
Total Posts:  17
Joined:  2009-04-28
Bavaria, Straubing
 

Hi,

I have an solution for “Step 3” for version 1.3.2.4.

1st)
Don’t change anything in the “Price.php”

2nd)
Go to “/htdocs/app/code/core/Mage/Catalog/Model/Product/Option/Type/Select.php” ----> Handles dropdown options

3rd)

- Got to Line 190.
- Comment all lines in the following elseif out.
- Paste following code after the comment:

$pType $option->getValueById($optionValue)->getPriceType();
            
$price $option->getValueById($optionValue)->getPrice();
            if(
$pType == 'absolute'{
                $result 
$basePrice * (-1) + $price;
                echo 
$result;
            
else {
                $result 
$this->_getChargableOptionPrice(
                    
$price,
                    
$pType == 'percent',
                    
$basePrice
                
);
            
}

Use this hack wisely. I can figure out why Varien don’t implement this feature.

Have Fun

Dominik Fischer

 
Magento Community Magento Community
Magento Community
Magento Community
 
cevans73
Jr. Member
 
Total Posts:  8
Joined:  2009-01-13
 

I’ve tried all these options and none work!  Has anyone been successful with any of these solutions?!  If so, I would love to know what you did.....

Thanks!
Chris

 
Magento Community Magento Community
Magento Community
Magento Community
 
SW09
Jr. Member
 
Total Posts:  4
Joined:  2010-01-05
 

I have try the solution mention above but no luck. The custom option price not working at all. Any one have a solution pls help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lapplander
Jr. Member
 
Total Posts:  9
Joined:  2008-08-25
Stockholm
 

Thanks cushionguru,

I used your solution with just small changes.

First I copied the file app/code/core/Mage/Catalog/Block/Product/View/Options/Abstract.php
to app/code/local/Mage/Catalog/Block/Product/View/Options/Abstract.php

Create the directories if needed, this will keep the modified Abstract.php during upgrade.
Easy to do a diff between the two after an upgrade to see if anything is changed in the core one.

Then in the function

protected function _formatPrice
I just changed the value being returned to null

So on line 141 change

return $priceStr;
to
return;

Works on 1.3.2.4

I like this solution as it’s simple!

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
grazzt
Sr. Member
 
Total Posts:  103
Joined:  2010-02-28
 

Anyone made this work at magento 1.4?

 
Magento Community Magento Community
Magento Community
Magento Community
 
cidadecyber
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2009-09-24
Sao Paulo, Brasil
 

I need a solution such as this for 1.4 in drop down format
anyone able to point me in the right direction?

thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
grazzt
Sr. Member
 
Total Posts:  103
Joined:  2010-02-28
 

Just bumping this so someone may find a solution

 
Magento Community Magento Community
Magento Community
Magento Community
 
watteria
Jr. Member
 
Total Posts:  1
Joined:  2009-08-09
 

is there any magento 1.4 custom options absolute prices solution?

 
Magento Community Magento Community
Magento Community
Magento Community
 
svabic
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2010-01-28
 
watteria - 23 May 2010 02:40 AM

is there any magento 1.4 custom options absolute prices solution?

Any options?

 Signature 

http://www.bukovickabanja.nstars.org

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 2 of 3
 
© Copyright 2012 Magento Inc.
Privacy Policy|Terms of Service
Magento Community Count
701238 users|907 users currently online|497183 forum posts