LemonStand Forum: Products visibility based on countries - LemonStand Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Products visibility based on countries

#1 User is offline   kenvunz 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 41
  • Joined: 22-August 10

Posted 22 August 2010 - 08:25 PM

Hi guys,

I'm new to Lemonstand and wondering if it is possible to implement this feature? If so, some tips to point me to the right direction would be great.

Cheers
Ken

This post has been edited by kenvunz: 23 August 2010 - 01:15 PM

0

#2 User is online   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 3,633
  • Joined: 31-October 09

Posted 23 August 2010 - 02:34 PM

Hi, Ken!

This feature is not implemented on the system level. You can implement it by yourself, but you should be a PHP developer. Basically, you need to extend the Product model with a new field - country list ("Has and Belongs To Many" relation). You can learn about creating data relations here:



The class the Counties relation should refer is Shop_Country (http://lemonstandapp...s_shop_country/).

After creating the data relation and extending the product form, you will be able to choose countries a product should be visible for, on the Create/Edit Product form. Also, you will need to apply the country filter using the where() method on the Shop_Category::list_products() method result and to all data sets which return product lists (manufacturer's products, custom product groups, etc. - it depends on your needs).

There is another issue - you need to ask a visitor which country he lives in. You can create a drop-down countries menu in the header of the website (for example) and set the billing/shipping country when user selects an item in the list.

I hope this helps!

Thank you

#3 User is offline   kenvunz 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 41
  • Joined: 22-August 10

Posted 23 August 2010 - 02:51 PM

perfect solution

thanks Aleksey
0

#4 User is offline   kenvunz 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 41
  • Joined: 22-August 10

Posted 23 August 2010 - 05:33 PM

Hi Aleksey,

Is there away to filter the checklist to display only countries that enabled in Settings >> Countries?
0

#5 User is online   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 3,633
  • Joined: 31-October 09

Posted 23 August 2010 - 05:39 PM

Hi!

Yes, you can use the conditions configuration option:

$product->add_relation('belongs_to', 'x_countries', array(... 'conditions'=>"enabled_in_backend=1"... ));


The enabled_in_backend field is always 1 if a country is enabled.

Thank you

Share this topic:


Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users