Jump to content

Custom price calculation for specific product


spaceace17

Recommended Posts

Hi to all, I'm writing here to find a solution for a big trouble in my PS 1.5.x store.
I need to add an extra cost to a specific produtc, which does not change with the product amount.
So if you order 1 unit the extra cost is $10, and remains the same if the ordered unities are 10, 100 or 1000.
PS does not allow an option like that, so I'm considering to do some customization in PS core.
I find a line of code in classes/Product.php which can do the job:
 

        // Attribute price
        if (is_array($result) && (!$specific_price || !$specific_price['id_product_attribute'] || $specific_price['price'] < 0))
        {
            $attribute_price = Tools::convertPrice($result['attribute_price'] !== null ? (float)$result['attribute_price'] : 0, $id_currency);
            // If you want the default combination, please use NULL value instead
            if ($id_product_attribute !== false)
                $price += $attribute_price;
        }

Can I add something like
 

if (product_id = 44) { $price = $price + 10; }

to add a certain value to a specific product?



 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...