Here i have added 3 dropdown list which is static and i want to show first 2 dropdown based on category "rings"
any solution?
Here i have added 3 dropdown list which is static and i want to show first 2 dropdown based on category "rings"
any solution?
I understand that you want to display 2 dropdown if a product from a specified category, is added in cart. To achieve that, a have build for you a simple module.
First let's declare our module in /etc/modules/Namespace_CheckCategoryOnCart.xml
<?xml version="1.0"?>
<config>
<modules>
<Namespace_CheckCategoryOnCart>
<active>true</active>
<codePool>local</codePool>
</Namespace_CheckCategoryOnCart>
</modules>
</config>
Next, in /app/code/local/Namespace/Namespace we have the following structure
/app/code/local/Namespace/Namespace/etc/config.xml
Contains
<?xml version="1.0"?>
<config>
<modules>
<Namespace_CheckCategoryOnCart>
<version>1.0.0</version>
</Namespace_CheckCategoryOnCart>
</modules>
<global>
<helpers>
<checkcategory>
<class>Namespace_CheckCategoryOnCart_Helper</class>
</checkcategory>
</helpers>
</global>
</config>
Helper class:
/app/code/local/Namespace/Namespace/Helper/Data.php
Contains
<?php
class Namespace_CheckCategoryOnCart_Helper_Data extends Mage_Core_Helper_Abstract
{
public function hasProductFromCategory(){
$cart = Mage::getModel('checkout/cart')->getQuote();
foreach ($cart->getAllVisibleItems() as $item) {
$categoryIds = $item->getProduct()->getCategoryIds();
foreach($categoryIds as $categoryId){
if($categoryId == "YOUR_RINGS_CATEGORY_ID"){
return true;
}
}
}
}
}
Now, in your cart.phtml you can check this condition using the following code:
if(Mage::helper('checkcategory')->hasProductFromCategory()){
//show your dropdown
}