php - Hide Stock Qty/Availability for Specific Attribute Set -


i have bit of odd situation trying fix. magento v1.9.2.4

  • i have 2 different attribute sets. , b.

  • i want display stock quantity/availability set b, not set a.

to make things bit more complex, have 14 customer groups, want 6 of groups ever see quantities/availability.

here's have done far arrange this:

$customersession = mage::getsingleton('customer/session'); if($customersession->isloggedin()){       $groupid = $customersession->getcustomergroupid();       $group = mage::getmodel('customer/group')->load($groupid);       if ('custgroup_1' == $group->getcode()){          $qty = (int) mage::getmodel('cataloginventory/stock_item')->loadbyproduct($_product)->getqty();         echo 'quantity available: ' . $qty;     } }  

the above snippet repeated 5 times [if ('custgroup_1' ...] changed accommodate group need show for. part working fine.

i need specify somehow want availability show attribute set b. regardless of customer group never show qty/availability attribute set a.

i have tried playing inventory options on product page. (disabled stock management = qty still shows | enabled stock management, set qty 0 , custom options disappear | ect.) nothing within magento backend seems work.

i'm newbie whole magento/dev thing. apologize if considered silly question.

thank any/all help!

so, after posting realized thinking problem wrong.

because item isn't in attribute set b isn't having stock managed, able write condition enables output products have inventory level greater 0.

here code might happen need show quantity products based on customer group, , hide availability item has inventory management set no, set "in stock".

$customersession = mage::getsingleton('customer/session'); if($customersession->isloggedin()){       $groupid = $customersession->getcustomergroupid();       $group = mage::getmodel('customer/group')->load($groupid);       if ('custgroup_1' == $group->getcode()){          $__manstock = $_product->getstockitem()->getmanagestock();          $__invamt = (int)mage::getmodel('cataloginventory/stock_item')->loadbyproduct($_product)->getqty();  if ($__manstock > 0)         echo $this->__("available qty:  $__invamt");     } }  

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

http - Safari render HTML as received -