justouletdk Posted September 26, 2010 Share Posted September 26, 2010 Hello,I am trying to make a php script which would render a html newsletter containing products based on user defined product id´s.so how do you get php to echo, for example, product price based on product id in prestashop? Link to comment Share on other sites More sharing options...
rocky Posted September 27, 2010 Share Posted September 27, 2010 Use the following: echo Product::getPriceStatic($id_product, true); Set the first parameter to ID of the product you want the price for and the second parameter to whether you want tax to be included. There are many more parameters, but those two are the important ones. Link to comment Share on other sites More sharing options...
justouletdk Posted September 27, 2010 Author Share Posted September 27, 2010 Thanks! works just fine.What about image url and reduction price? 1 Link to comment Share on other sites More sharing options...
justouletdk Posted September 27, 2010 Author Share Posted September 27, 2010 Solved this by using a piece of the code form xmlexport script which can be found here foreach ($products as $product) { if($product['id_product']==3135){ $prodObj = new Product($product['id_product'], false, $id_lang); $product['url'] = $link->getProductLink($prodObj); $cover = Product::getCover($product['id_product']); $product['imageUrl'] = _PS_BASE_URL_.$link->getImageLink($prodObj->link_rewrite, $product['id_product'].'-'.$cover['id_image'], 'large'); $product['price_inc'] = ($product['price'] * (1 + $product['tax_rate'] / 100)) - $product['reduction_price']; $product['price_for'] = ($product['price'] * (1 + $product['tax_rate'] / 100)); $product['description_short'] = my_strip_tags($product['description_short']); echo $product['url']; echo $product['imageUrl']; echo $product['price_for']; echo $product['price_inc']; } } where 3135 is where the id of the product should be. ['price_for'] stands for price without discount. There was probably a 1000 times easier way to do this:) ? Link to comment Share on other sites More sharing options...
soundsystemconnection Posted November 29, 2011 Share Posted November 29, 2011 Hi, could you explain to me how to add products in the HTML newsletter? i don't understand how to modify the AdminNewsletter php thanks for the help!!!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now