Jump to content

[SOLVED] How to change price product after click add to cart button


themreviil

Recommended Posts

Hi,

I'm writing module to configuration product and when client choose all what he needs click add to cart. But i must change price this product. I tring change element in form with price but don't work and I was using special price and fucntion applyRuleToProduct(); but in wasn't good. because special price is for time or for product.

Thanks for help

Link to comment
Share on other sites

  • 1 month later...

I found solution to this. I created extra table with my new price product and insert this after click "Add to cart" button. Next step in Product.php in methihod priceCalculation().

after 

// Customization price
if ((int) $id_customization) {
	$price += Tools::convertPrice(Customization::getCustomizationPrice($id_customization), $id_currency);
}

I insert my code with get currently price my product.

$price = Db::getInstance()->getValue('SELECT price FROM `' . _DB_PREFIX_ . 'my_new_prod_price` WHERE `user_id`='.$user_id.' OR `user_id`='.Context::getContext()->cookie->id_guest.' AND `product_id`='.$id_product.' AND `cart_id`='.$id_cart.';');

 

PROBLEM SOLVED

Link to comment
Share on other sites

  • themreviil changed the title to [SOLVED] How to change price product after click add to cart button

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...