Price filter & Access Level

  • Posts: 52
  • Thank you received: 0
  • Hikashop Business
8 years 9 months ago #228773

-- HikaShop version -- : 2.6.1
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.3.15

Hi,
I have two different prices for my products - one for distributors and one for all other user groups.
When I have price filter with "Dynamic display" option on, the filter shows the lower distributor price of the cheapest product on the initial loading even when you are not logged on as distributor. If I change the maximum value of the filter it detects that the minimum price of the products is higher and fixes the scroll bar minimum value.
Is there a way to fix this issue?

P.S. I haven't tested the opposite case: What would be the maximum value of the price scroll bar if you are logged on as distributor, i.e. the most expensive product will have lower distributor price and higher end user price. Which price would the filter detect on the initial loading?

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 9 months ago #228775

Hi,

Try to change the code:

$copy_query=str_replace('WHERE','LEFT JOIN '.hikashop_table('price').' AS pprice ON '.$product_table.'.product_id=pprice.price_product_id WHERE',$copy_query);
to:
$replace = 'LEFT JOIN '.hikashop_table('price').' AS pprice ON '.$product_table.'.product_id=pprice.price_product_id WHERE';
						$conditions = array();
						hikashop_addACLFilters($conditions, 'price_access', 'pprice');
						if(count($conditions))
							$replace .= ' '.$conditions[0].' AND';
						$copy_query=str_replace('WHERE',$replace,$copy_query);
in the file administrator/components/com_hikashop/classes/filter.php
That should hopefully fix the issue.

Last edit: 8 years 9 months ago by nicolas. Reason: fixed code

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

  • Posts: 52
  • Thank you received: 0
  • Hikashop Business
8 years 9 months ago #228887

Prompts an error - I think it was 1064.
Maybe there is a problem in the statement.

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 9 months ago #228892

Hi,

What is the exact error message you get ?

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

  • Posts: 52
  • Thank you received: 0
  • Hikashop Business
8 years 9 months ago #228975

1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERELEFT JOIN fx904_hikashop_price AS pprice ON b.product_id=pprice.price_produ' at line 1 SQL=SELECT DISTINCT b.product_id FROM fx904_hikashop_product_category AS a LEFT JOIN fx904_hikashop_product AS b ON a.product_id=b.product_id LEFT JOIN fx904_hikashop_price AS pprice ON b.product_id=pprice.price_product_id WHERELEFT JOIN fx904_hikashop_price AS pprice ON b.product_id=pprice.price_product_id WHERE (pprice.price_access = 'all' OR pprice.price_access LIKE '%,1,%') AND b.product_published=1 AND b.product_type = 'main' AND a.category_id IN (20) AND (b.product_access = 'all' OR b.product_access LIKE '%,1,%') ORDER BY b.product_custom_ordering ASC

Attachments:

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 9 months ago #228997

Hi,

Thank you.

I had made a mistake in the code I had given. I've fixed the code in my previous message. You shouldn't have that error anymore if you update the code with the new version of it in my previous message.

The following user(s) said Thank You: ydingilski

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

  • Posts: 52
  • Thank you received: 0
  • Hikashop Business
8 years 9 months ago #229159

Hi nicolas,
Now it's working fine, Thank you.

Last edit: 8 years 3 months ago by ydingilski.

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

Time to create page: 0.064 seconds
Powered by Kunena Forum