[Skip to main content](#vessel-content)

#   product, price, discount

##

- **[tecnet](/forum/user/1078-tecnet "View tecnet's Profile")**
- [![tecnet's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1078-tecnet "View tecnet's Profile") Topic Author
- [ Offline](/forum/user/1078-tecnet)

Less More

- Posts: 16
- Thank you received: 0
-
-

15 years 8 months ago -  15 years 8 months ago [\#9548](#9548) by [tecnet](/forum/user/1078-tecnet "View tecnet's Profile")  *[product, price, discount](/forum/4-how-to/9548-product-price-discount#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&#95;flat&#95;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.")* was created by *[tecnet](/forum/user/1078-tecnet "View tecnet's Profile")*

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: 15 years 8 months ago by [tecnet](/forum/user/1078-tecnet "View tecnet's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzk1NDgtcHJvZHVjdC1wcmljZS1kaXNjb3VudD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86561
- Thank you received: 14307
-
-

15 years 8 months ago [\#9550](#9550) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: product, price, discount](/forum/4-how-to/9548-product-price-discount#9550 "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&#95;flat&#95;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.")*

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 =&amp; hikashop::config();
$main_currency = $config-&gt;get('main_currency');
$zone_id = hikashop::getZone();
$discount_before_tax = $config-&gt;get('discount_before_tax');
$currencyClass = hikashop::get('class.currency');
$currencyClass-&gt;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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzk1NDgtcHJvZHVjdC1wcmljZS1kaXNjb3VudD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[tecnet](/forum/user/1078-tecnet "View tecnet's Profile")**
- [![tecnet's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1078-tecnet "View tecnet's Profile") Topic Author
- [ Offline](/forum/user/1078-tecnet)

Less More

- Posts: 16
- Thank you received: 0
-
-

15 years 8 months ago [\#9554](#9554) by [tecnet](/forum/user/1078-tecnet "View tecnet's Profile")  Replied by *[tecnet](/forum/user/1078-tecnet "View tecnet's Profile")* on topic *[Re: product, price, discount](/forum/4-how-to/9548-product-price-discount#9554 "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&#95;flat&#95;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.")*

Works! Thank you very much.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzk1NDgtcHJvZHVjdC1wcmljZS1kaXNjb3VudD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.043 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
