product, price, discount

  • Posts: 16
  • Thank you received: 0
13 years 8 months ago #9548

Hello,
we are using hikashop and had to do some adjustments for our views. We created new layout options for products and also the layouts itself. In these layouts we use the product information we receive from hikashop. But in the product information view (show.php) we need to show more than one product. So we ask for the other products by sql query and try to visualize them. Our problem is that the product object by hikashop have special informations like 'discount_flat_amount' that is created by hikashop itself when receiving values from the database and build the product object.
What we are looking for is some API functions that can be used to create a product object like hikashop does by passing the product id or to create the discounts/prices parts of the product object.

Last edit: 13 years 8 months ago by tecnet.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 8 months ago #9550

Hi,

There is not one function to easily do that. You can do something like that:

//$element is either a object of the information of a product from the product table or an array of these same objects.
//$ids is an array of all the ids of the $element variable
$currency_id = hikashop::getCurrency();
$config =& hikashop::config();
$main_currency = $config->get('main_currency');
$zone_id = hikashop::getZone();
$discount_before_tax = $config->get('discount_before_tax');
$currencyClass = hikashop::get('class.currency');
$currencyClass->getPrices($element,$ids,$currency_id,$main_currency,$zone_id,$discount_before_tax);


That will set the prices with discounts and conversion of currency.

Please Log in or Create an account to join the conversation.

  • Posts: 16
  • Thank you received: 0
13 years 8 months ago #9554

Works! Thank you very much.

Please Log in or Create an account to join the conversation.

Time to create page: 0.061 seconds
Powered by Kunena Forum