Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Product function definitions? 
 
cismerc
Jr. Member
 
Avatar
Total Posts:  4
Joined:  2012-10-04
 

(Should have posted in this forum instead of the “How do I?” sorry for the double post.)

Hello Magento Community,

I’m am fairly new to Magento and I’ve hit a dead end. So I wanted to ask the community for some guidance.

Anyway, quick break down:
Customer visiting a website clicks on a product, the product loads and the quantities available are displayed for each physical store. Now, each individual quantity is pulled from a defined product attribute. No problems here. I’ve hunted down 3 files that are responsible for displaying these custom quantities. The code below is a snippet from the workhorse which pulls everything together.

My question:
What I don’t understand is where do the functions “getStoreTwo()”, “getStoreThree()” get defined. They are member functions of the child object which is an instance of a single product out of a collection of products. Is there a specific file which contains all the function definitions for the product? I understand that “getStoreTwo()” is custom function, someone before me has defined it somewhere… if it was you, where would you have defined it smile? Any help is greatly appreciated.

$pProduct Mage::getModel('catalog/product')->load($_POST['product']);
$childProducts Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null$pProduct);
  .
  .
  .
  
foreach(
$childProducts AS $child{
  
.
  .
  .
  if(
$isGood == 1{
    $selectedProduct 
Mage::getModel('catalog/product')->load($child->getEntityId());
    
$hasSpecialPrice = (bool)$selectedProduct->getSpecialPrice();
    
$productPrice Mage::helper('core')->formatPrice($selectedProduct->getPrice(), false);
    
$productSpecialPrice Mage::helper('core')->formatPrice($selectedProduct->getSpecialPrice(), false);
    if(
$hasSpecialPrice{$productPrice $productSpecialPrice;}

    
echo $child->getEntityId().'###'.number_format($stock->getQty()).'###'.$child->getStoreTwo().'###'.$child->getStoreThree().'###'.$child-getFulfillmentlatency().'###'.$productPrice;
    break;
  
}
}
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top