• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
View product based on category and subcategory

#1
i am developing a eCommerce site. In this I have Category and its Sub-category. Some Category have its Sub-category and Some Category have not its Sub-category. Example I have category of 'Mobile Phones' its have no Sub-category. and the Category 'Home Appliances'  have sub category like 'Freeze, Air Cooler' etc. I have view product page I want to view the product based on category if its has no subcategory . and  if the category have subcategory then I want to load its sub-category first after that I want to view the product based on the its sub-category not based on Category. In category table I have a column name 'addSubCat' that specifies the category has a sub-category or not. if the column value is 1 then it has subcategory and if it has 0 then no sub-category
Reply

#2
There is no question here.

If you are asking how you deal with categories and sub categories, you can do this in several ways.

An easy way is just to check if there is a sub category or not. If there is, use that information in your view. If there is not, use the category information (if any - it is always possible that a product is not listed for a category or a sub category).

You do not need the 'has sub category' column. You lookup the category, then you look for subcategories. If none found it has no sub categories, if some found, then it has. I presume you have a category parent column so you know which parent a subcategory belongs to.

Paul.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.