Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2006
    Location
    Cardiff, Wales
    Posts
    305
    Plugin Contributions
    0

    Default Percentage Increase On Attribute Price?

    Hi

    Looks like this question has been asked a number of times but i cannot find an answer...

    I need to add on a percentage to the final price if a certain attribute is chosen. The product is 0 price and priced by attributes. Basically there are many Sizes to choose, each with a price. If they then choose a certain option like "Finish" for example, it needs to add 10% to the chosen attribute price.

    It seems Price Factor only works on the Base Price. The Base Price is the lowest priced attribute. The Price Factor is calculating the 10% based on that and not on the chosen attribute.

    Does anyone know how to get this to work? Adding a percentage on the final price of the product, which is priced by attributes?

    Thanks a lot

  2. #2
    Join Date
    Jul 2006
    Location
    Cardiff, Wales
    Posts
    305
    Plugin Contributions
    0

    Default Re: Percentage Increase On Attribute Price?

    Following up on this, I have another idea I wondered if anyone has any advice...

    It would be good if we can pass a custom price to the order... e.g. I can use Javascript to do some calculations (or PHP after I submit the page) and arrive at a custom price. I need to be able to enter this price in the order though of course.

    So I wondered if anyone has an idea. My initial idea is using some quantity box for an attribute with 1 = 1p, then I can just multiply the quantity of this attribute by the amount I need. Call the attribute Price Adjustment or something. I can hide this box in the Stylesheet and use Javascript or PHP after submission to alter the quantity.

    What do you think of that? I'll have to see if attribute quantities can be used.

  3. #3
    Join Date
    Jul 2006
    Location
    Cardiff, Wales
    Posts
    305
    Plugin Contributions
    0

    Default Re: Percentage Increase On Attribute Price?

    I may have found a workaround...

    Firstly, I dont understand why Price Factor uses the Base Price, because this will be the lowest attribute price which is not applicable if you choose a higher costing attribute, rendering price factor useless when priced by attributes.

    So I thought maybe I could change this bit of code, so instead of the Price Factor using the Base Price, it uses the price of the attribute chosen.

    So in classes/shopping_cart.php and /includes/functions/functions_prices.php, I found reference to:

    function zen_get_attributes_price_factor()

    I altered this to instead of calling the base price, to call the attribute price.

    I changed all references but the one that worked for my situation was line 906 on shopping_cart.php:-

    Code:
    $added_charge = zen_get_attributes_price_factor($chk_price, $chk_special, $attribute_price->fields['attributes_price_factor'], $attribute_price->fields['attributes_price_factor_offset']);
    to
    Code:
    $added_charge = zen_get_attributes_price_factor($attributes_price, $chk_special, $attribute_price->fields['attributes_price_factor'], $attribute_price->fields['attributes_price_factor_offset']);
    This is not fully tested and probably does not work when you do use a product price and not priced by attributes (so it would need more code to get it to work on all cases) but this works for my setup.

    This means I can now add an extra Checkbox attribute called Price Factor, or Extra 10% or whatever, using only a 0.1 price factor. Then using Javascript when someone chooses a certain attribute that will add the 10% it will check this box, and if they change away from this selection, remove the checkbox. PHP could also be used server side after submission to cater for non-JS, but JS is easier for now.

    So this way, if it continues to work with no consequences, I can add on 10% or any percent onto a chosen attribute.

  4. #4
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,229
    Plugin Contributions
    6

    Default Re: Percentage Increase On Attribute Price?

    Hi did you manage to find a working solution to this as I need the same? I wondered if it would be possible to fully share what your did?
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  5. #5
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,229
    Plugin Contributions
    6

    red flag Re: Percentage Increase On Attribute Price?

    Quote Originally Posted by Nick1973 View Post
    Hi did you manage to find a working solution to this as I need the same? I wondered if it would be possible to fully share what your did?

    Just thought I'd add I have this working successfully and the price remains as it should all the way through the shopping cart, the only problem is the price doesn't update to the correct price in Sub-Total: in the shopping cart even though the price updates everywhere else so where would I change the code that controls what happens in <?php echo $cartShowTotal; ?> or Sub Total:
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

 

 

Similar Threads

  1. Attribute price by percentage
    By somi97 in forum Setting Up Categories, Products, Attributes
    Replies: 7
    Last Post: 2 May 2016, 08:40 PM
  2. Price Increase/Decrease by Percentage [Support Thread]
    By badarac in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 4 Apr 2016, 03:23 PM
  3. v151 Attribute Prices - Increase all of them by £5 or fixed percentage
    By Matt Staines in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 5 Aug 2014, 08:16 PM
  4. Attribute percentage of TOTAL calculated price
    By AIWebSystems in forum General Questions
    Replies: 2
    Last Post: 25 Jan 2011, 10:13 AM
  5. Percentage increase on attribute pricing
    By monmouthtaxis in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 20 Jun 2008, 11:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg