Slettet Fra Ukjent 2 juli 2018 21:17 Hi, we have entered "regular" price and other prices by the groups. On product pages, we are displaying "regular" prices to everyone, and registered users receive their prices, as they should. I would like to show difference between those prices, but can't seem to display both prices at the same time. Are they overwritten before displaying? Basicly like this: Price:100 Group1: 90 Group2: 80 ... Guests see: 100 Registered user with Group1 sees: 90 [s]100 [/s](10 less) Something like that, as we are displaying some calculations with both prices (before this asson, we used fixed percentage. Thanks for hints :) Nejc
tim Founder Fra Sweden Medlem siden tim 3 juli 2018 03:28 Yes they are overwritten before sent to the view file. You would have to access the database to retrieve them or go through the ctrl oject. var_dump( reference::ctrl_product($product_id)->customer_group_prices ); At least I think that was the name of the parameter inside ctrl_product. I'm on mobile.
Slettet Fra Ukjent 4 juli 2018 13:42 So, those prices can't really just simply be retrieved. I would also use that in XML outputs, as with that addon installed and in use, it's not really usable anymore. What if I would manually set user id, at least in XML, would that output correct price?
tim Founder Fra Sweden Medlem siden tim 4 juli 2018 17:57 If accessing the set of prices from the database filtered an ready with one command is not simple then I have lost the meaning of the word :-D
Slettet Fra Ukjent 11 juli 2018 21:12 No, getting those prices is just fine, but how to also get "regular" price, which is now only visible to non registered users?
tim Founder Fra Sweden Medlem siden tim 11 juli 2018 21:34 Right, and reference::product($product_id)->price would be overwritten by the customer price. You can insert this into ref_product.inc.php: $this->_data['price'] = 0; $products_prices_query = database::query( "select * from ". DB_TABLE_PRODUCTS_PRICES ." where product_id = ". (int)$this->_id ." limit 1;" ); $product_price = database::fetch($products_prices_query); if ($product_price[$this->_currency_code] != 0) { $this->_data['price'] = currency::convert($product_price[$this->_currency_code], $this->_currency_code, settings::get('store_currency_code')); } else { $this->_data['price'] = $product_price[settings::get('store_currency_code')]; } break;``` Then access by [b]reference::product($product_id)->original_price[/b]
Slettet Fra Ukjent 12 juli 2018 20:20 I think something is missing, as this is returning NULL. Isn't price overwriten with regular_price? edit: ah, just changed the two lines to $this->_data['original_price'] Now I get float value returned :) As always, thanks for help!