how to show products in Magento based on selected state and city? is there any extension available for this feature? or how can i achieve this?
Asked
Active
Viewed 709 times
-1

Naveenbos
- 2,532
- 3
- 34
- 60
-
What do you mean by product stat or product city? The city/state for customer? for billing? shipping? The city/state where the product are manufactured? – Nolwennig Aug 03 '15 at 07:13
-
When the customer come to website he will receive a popup first, then he should select the state and city, based on this he can see the products which is assigned to particular state or city, Is it possible to do this kind of feature in magento, Is there any extension available? or how i can build this? – Naveenbos Aug 03 '15 at 08:24
-
Asking for extensions is off topic on Stack Overflow. Perhaps you should post it on http://magento.stackexchange.com instead? – Enigmativity Dec 25 '15 at 05:04
1 Answers
2
You can add one (city) or two (state and city) attributes in product model (by back-office panel).
Your news attributes can be contain the list (in example string with delimiter commas) with the list of state/city where the product is allowed to be sell.
For retrieve your state/city allowed list you can :
<?php
// id product is 12345
// the city allowed list attribute code is 'city_list'
$id = 12345;
$product = Mage::getModel('catalog/product')->load($id);
$cityList = $product->getAttributeText('city_list');
var_dump($cityList);
Output something like this :
string(38) "Los Angeles, New Delhi, Caen, etc, etc"
It's possible that you may be add ->getAttributeToSelect('city_list')
after load($id)
if the attribute isn't retrieve by catalog/product
model.

Nolwennig
- 1,613
- 24
- 29