1. Which of the following will display a customer's TAX/VAT number?
Answers:
• $taxvat = $order['customer_taxvat'];
• $order->getData('customer_taxvat');
• $order->getQuote()->getCustomerTaxvat();
• $order->getData()->getCustomerTaxvat();
2. Why does the error, "front controller reached 100 router match iterations", occur?
Answers:
• There is an error in the code.
• Some modules failed to load.
• Router references were set incorrectly.
• .htacces is blocking URLs.
3. Which of the following will sort products in the catalog by the date they were added?
Answers:
• Under "app/code/core/Mage/Catalog/Model/Config.php", add this value to the $options array: 'created_at' => Mage::helper('catalog')->__('Date')
• Under "app/code/core/mage/catalog/model/resource/eav/mysql4/product/collection.php", add this value to the $options array: $this->getSelect()->order("e.entity_id desc");
• Under "app/code/core/Mage/Catalog/Model/Config.php", add this value to the $options array: 'sort_by' => Mage::helper('catalog')->__('Date')
• It's not possible to sort products in the catalog by date.
4. Is it possible to trigger an event after an order has been set to "processing"?
Answers:
• Yes, by using a custom module.
• Yes, by registering an event.
• No, since it's a security threat.
• No, since no additional action can be added at this stage.
5. Which of the following code samples will get all products sorted by 'position', assuming 'position' is of a numeric type?
Answers:
• $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*') ->addAttributeToSort('position', 'ASC'); ->load();
• $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*') ->addOrder('position', 'ASC'); ->load();
• function cmp($a, $b) { if ($a == $b) { return 0; } return ($a < $b) ? -1 : 1; } $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*') ->load(); usort($products, "cmp");
• function mySortByPosition($a, $b) { if ($a['position'] == $b['position']) { return 0; } return ($a['position'] < $b['position']) ? -1 : 1; } $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*') ->addSorter(mySortByPosition) ->load();
6. Which of the following statements are correct about Magento quotes?
Answers:
• Quotes are offers to the user, which if the user accepts get converted into orders.
• The lifetime of the quote cannot be controlled.
• Quotes don't deal with metadata about the store.
• Quotes are not related to order payment and shipping method information.
7. Select which method will register observers/hooks to events in Magento:
Answers:
• Mage::registerObserver(‘<EventNameToHook>’,’MyClass::observerFunction’);
• Using the option in the Magento Admin panel: System > Configuration > Advanced > Developer > Register Observer
• Registering observers using the XML layout of the module: <events> <EVENT_TO_HOOK> <observers> <module> <type>singleton</type> <class>company_module_model_observer</class> <method>methodToCall</method> </module> </observers> </EVENT_TO_HOOK> </events>
• Mage::registerObserver(‘myglobalobserver’); Function myglobalobserver($event,$args){ switch($event){ case ‘event1’: processevent1($args); break; case ‘event2’: processevent2($args); break; } }
8. Magento has the ability to run multiple stores from the same database. After adding the new store from System -> Manage Store, what is the correct code to add to the htaccess file to make Magento automatically load the new store?
Answers:
• RewriteCond %{HTTP_HOST} ^oldstore.com RewriteRule ^ - [E=MAGE_RUN_CODE:yourOldStoreCode] RewriteRule ^ - [E=MAGE_RUN_TYPE:website]
• RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ - [E=MAGE_RUN_CODE:yourNewStoreCode] RewriteRule ^ - [E=MAGE_RUN_TYPE:website]
• RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ - [E=MAGE_RUN_CODE:yourStoreCode] RewriteRule ^ - [E=MAGE_RUN_TYPE:website]
• RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ - [E=MAGE_RUN_CODE:yourNewStoreCode] RewriteRule ^ - [E=MAGE_RUN_TYPE:website]
9. Which of the following will save a custom session variable in Magento?
Answers:
• $_SESSION['name'] = 'frontend';
• $session = Mage::getSingleton("core/session", array("name"=>"frontend")); $session->setData("device_id", 4);
• Mage::getSingleton( 'customer/session' )->setValue( 'name', array( 1, 2, 3 ) );
• None of the above
10. Which of the following will get information ('customer_referrer_id') from a currently logged-in admin user?
Answers:
• $collection->addAttributeToFilter('customer_referrer_id', $referrer_id); $referrer_id = Mage::getSingleton('admin/session')->getUser()->getId();
• $collection->addAttributeToSelection('customer_referrer_id', $referrer_id); $referrer_id = Mage::getSingleton('admin/session')->getUser()->getId();
• $collection->addAttributeToFilter('customer_referrer_id', $referrer_id); $referrer_id = getSingleton('admin/session')->getUser()->getId();
• None of these.
11. Which of the following will display a product's thumbnail?
Answers:
• $product->hasThumbnail()) $product->setThumbnail($product->getImage());
• <img src="<?php echo $this->helper('catalog/image')->init($_item->getProductThumbnail(), 'image')->resize(50); ?>" alt="<?php echo $_item->getName() ?>" />
• <img src="<?php echo $_item->getProduct()->getThumbnailUrl() ?>" alt="<?php echo $_item->getName() ?>" />
• <img src="<?php echo $this->helper('catalog/image')->init($_item->getProduct(), 'thumbnail')->resize(50); ?>" alt="<?php echo $_item->getName() ?>" />
12. Consider the following code:
<block type="A/B" name="root" output="toHtml" template="example/view.phtml">
What is the meaning of A/B?
Answers:
• "Module's alias" / "Class name relative to the alias"
• "Controller's Alias" / "Class name relative to the alias"
• "Controller's Class" / "Method Name"
• "Method Name" / "Parameter"
13. Which of the following code samples will display a list of both active and inactive sub-categories of the current category?
Answers:
• <?php $_category = $this->getCurrentCategory(); $collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id); $helper = Mage::helper('catalog/category'); foreach ($collection as $cat): if($_category->getIsActive()): $cur_category = Mage::getModel('catalog/category')->load($cat->getId()); ?> <a href="<?php echo $helper->getCategoryUrl($cat);?>"> <?php echo $cat->getName();?> </a> <?php endif; endforeach; ?>
• <?php $_category = $this->getCurrentCategory(); $collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id); $helper = Mage::helper('catalog/category'); foreach ($collection as $cat): $cur_category = Mage::getModel('catalog/category')->load($cat->getId()); ?> <a href="<?php echo $helper->getCategoryUrl($cat);?>"> <?php echo $cat->getName();?> </a> <?php endforeach; ?>
• <?php $_helper = Mage::helper('catalog/category'); $_categories = $_helper->getStoreCategories(); if (count($_categories) > 0): foreach($_categories as $_category): ?> <a href="<?php echo $_helper->getCategoryUrl($_category) ?>"> <?php echo $_category->getName() ?> </a> <?php endforeach; endif; ?>
• None of the above.
14. Which of the following will return a visitor's UserAgent information?
Answers:
• Mage::helper('core/http')->getHttpUserAgent()
• Mage::helper('core/mage')->getHttpUserAgent()
• Mage::helper('core/mage')->getHttpAgent()
• Mage::helper('core/http')->getHttpUserServer()
15. How can account navigation links be changed?
Answers:
• Using an XML file to define the template
• Using a third party module
• Either using an XML file to define the template, or using a third party module
• None of these.
16. Which of the following will correctly add a custom event in Magento?
Answers:
• Mage::registerEvent
• Mage::dispatchEvent
• Mage::addAction
• Mage::registerObserverEvent
17. Which XML file(s) should be checked when the following Magento error occurs during installation?
"PHP Extensions "0" must be loaded"
Answers:
• config.xml in app/code/core/Mage/Install/etc
• install.xml in app/code/core/Mage/Install/etc
• extensions.xml in app/code/core/Mage/Install/etc
• None of these
18. Which of the following will set a template only if a particular module is disabled in Magento?
Answers:
• <action method="setTemplate" ifconfig="advanced/modules_disable_output/Myname_Mymodule"> <template>mytemplate.phtml</template> </action>
• Using File: app/code/core/Mage/Core/Model/Layout.php protected function _generateAction($node, $parent) { if (isset($node['ifconfig']) && ($configPath = (string)$node['ifconfig'])) { if (!Mage::getStoreConfigFlag($configPath)) { return $this; } }
• <action method="setTemplate"> <template helper="mymodule/myhelper/switchTemplateIf"/> </action>
• None of these.
19. Which of the following XML files will remove an item from Magento's admin panel navigation?
Answers:
• <?xml version="1.0" ?> <config> <menu> <xmlconnect> <disabled>1</disabled> </xmlconnect> </menu> </config>
• <?xml version="1.0" ?> <config> <menu> <xmlconnect> <hide>1</hide> </xmlconnect> </menu> </config>
• <?xml version="1.0" ?> <config> <menu> <xmlconnect> <delete>1</delete> </xmlconnect> </menu> </config>
• Items under the Magento admin panel can't be removed.
20. Which of the following will get active store information (such as the store's name) in Magento?
Answers:
• Mage::app()->getStore();
• Mage::app()->getStoreId();
• Mage::app()->getName();
• None of the above
21. What is the best way to store session values in Magento?
Answers:
• $myValue=’Hello world’; Mage::getSingleton( 'customer/session' )->setMyValue($myValue);
• $myValue=’Hello world’; Mage::getSingleton( 'core/session' )->setMyValue($myValue);
• $myValue=’Hello world’; Mage::getSingleton( 'core/variable' )->setMyValue($myValue);
• $myValue=’Hello world’; $_SESSION[‘MyValue’] = $myValue;
22. The "Suspected Fraud" Order status is grouped under which state?
Answers:
• Processing state
• Payment Processing state
• Pending shipment state
• Payment Review state
23. Which of the following needs to be edited to input and display the order attributes in Magento?
Answers:
• /app/design/adminhtml/default/default/template/sales/order/view/info.phtml
• /app/design/adminhtml/default/default/template/salesext/edit_form.phtml
• /app/code/local/CWACI/SalesExt/controllers/Adminhtml/Sales/OrderController.php
• Both /app/design/adminhtml/default/default/template/sales/order/view/info.phtml and /app/code/local/CWACI/SalesExt/controllers/Adminhtml/Sales/OrderController.php
24. When using a custom Magento logo as the default logo for transactional emails; which of the following is the correct way for the logo to be maintained even after Magento system upgrades?
Answers:
• Replace the logo in the base theme skin directory.
• Create a new theme and replace the new logo in the skin directory.
• Update the logo in all transactional emails.
• Create a new theme and place the new logo, named as "logo_email.png", in the skin directory.
25. When does the following error occur? "Not all products are available in the requested quantity"
Answers:
• When the products are out of stock, but the cart still proceeded to checkout
• When the products are in stock, but not in the cart
• When no products are available
• None of these.
26. Which of the following will change the order of existing blocks via XML?
Answers:
• <reference name="parent.block.name"> <action method="unsetChild"><alias>child_block_alias</alias></action> <action method="insert"><blockName>child.block.name</blockName><siblingName>name_of_block</siblingName><after>1</after><alias>child_block_alias</alias></action> </reference>
• <reference name="parent.block.name"> <action method="insert"><blockName>child.block.name</blockName><siblingName>name_of_block</siblingName><after>1</after><alias>child_block_alias</alias></action> <action method="unsetChild"><alias>child_block_alias</alias></action> </reference>
• <reference name="child.block.name"> <action method="unsetParent"><alias>child_block_alias</alias></action> <action method="insert"><blockName>parent.block.name</blockName><siblingName>name_of_block</siblingName><after>1</after><alias>child_block_alias</alias></action> </reference>
• It is not possible to edit the order of existing blocks.
27. Which of the following is the minimum memory requirement for running a Magento site?
Answers:
• at least 128MB
• at least 256MB
• at least 512MB
• over 512MB
28. How can the checkout process be skipped for downloadable products in Magento?
Answers:
• The checkout step cannot be skipped in Magento.
• Downloadable products automatically do not require checkout.
• There is an option in the admin panel to skip the checkout step for downloadable products.
• Magento does not support downloadable products.
29. Which of the following conditions must be met in order to successfully run a Magento install script?
Answers:
• The install script should be placed in MODULE/sql/RESOURCES_KEY/SCRIPT_NAME.
• The install script should be named using the convention, mysql4-install-MODULE_VERSION.php
• The module version in config.xml and in the install script file name must be same.
• All of these.
30. When migrating a Magento store to a new server, after moving the files and the database, where must the database access details be configured for the new server?
Answers:
• Database table ‘core_config_data’
• config.inc file at magento root
• app/etc/config.xml
• app/etc/local.xml
31. What is the best way to create global variables which can be used everywhere in Magento?
Answers:
• Creating a empty module and adding a system.xml file to it
• Using the Magento Admin panel: System > Custom Variables > create a new custom variable
• Via a Magento Session $myValue = 'Hello World'; Mage::getSingleton('core/session')->setMyValue($myValue);
• $myValue = 'Hello World'; Mage::getModel('core/variable')->addMyValue($myValue);
32. The browser is ignoring the file referred on the code below:
<link src="http://siteurl.com/theme/skin/frontend/default/mytheme/css/colors.css.php" rel="stylesheet" type="text/css">
Assume that this is a PHP file that is used as a stylesheet in a Magento extension.
Which of the following choices will make the browser apply the stylesheet?
Answers:
• There is no solution; a PHP file cannot be used as a stylesheet.
• Use the "href" attribute instead of "src" to specify the file's location, as in: <link href="http://siteurl.com/theme/skin/frontend/default/mytheme/css/colors.css.php" rel="stylesheet" type="text/css">
• Call a static CSS file instead of using a PHP file as a stylesheet.
• Send a valid Content-Type HTTP header, as in: header("content-type: text/css");
33. What is the recommended way to override/extend Magento core functionality?
Answers:
• Directly edit the core files of Magento with proper commenting.
• Mage::registerOverride(‘CoreClassName’,’CoreFunctionName’,’MyClassName’,’MyFunctionname’);
• Copy the original Magento core file to the app/code/local folder and customize that file.
• Create extended versions of core files in their own folder with extension information. app/code/core/Mage/Cms/Model/Page.php app/code/core/Mage/Cms/Model/Page.1.php App/code/core/Mage/Cms/Model/Page.2.php
34. An observer in Magento is defined as a:
Answers:
• Method
• Class
• Event
• None of these.
35. What is the difference between "Flush Magento Cache" and "Flush Cache Storage" in the Magento Cache Management System?
Answers:
• "Flush Magento Cache" removes "/tmp/" folder's cache only, while "Flush Cache Storage" clears everything.
• "Flush Cache Storage" removes "/tmp/" folder's cache only, while "Flush Magento Cache" clears everything.
• "Flush Magento Cache" and "Flush Cache Storage" are equivalent; they work the same way.
• None of the above.
36. Which of the following will get a list of products belonging to a specific category within a view file?
Answers:
• $productCollection = Mage::getResourceModel('catalog/product_collection') ->addCategoryFilter($category);
• {{block type="catalog/product_list" category_id="7" template="catalog/product/list.phtml"}}
• $productCollection = Mage::getResourceModel('catalog/product_collection') ->addFilter($category);
• $productCollection = Mage::getModel('catalog/product_collection') ->addCategoryFilter($category);
37. Assuming that trees must have categories as parents and products as children, and that there are no sub-categories under main categories, which of the following code samples will get the full catalog tree?
Answers:
• $categories = Mage::getModel('catalog/category') ->getCollection(); foreach ($categories as $category) { print $category->getName(); $categoryDetails = Mage::getModel('catalog/category')->load($category->getId()); $products = $categoryDetails->loadChildProducts(); foreach($products as $product){ Print $product->getName(); } }
• $categories = Mage::getModel('catalog/category') ->getCollection(); foreach ($categories as $category) { print $category->getName(); $products = Mage::getModel('catalog/category') ->load($category->getId()) ->getProductCollection(); foreach($products as $product){ Print $product->getName(); } }
• $categories = Mage::getModel('catalog/category') ->getCollection() ->setLoadProducts(true); foreach ($categories as $category) { print $category->getName(); foreach($category->getProducts() as $product){ print $product->getName(); } }
• $products = Mage::getModel('catalog/product') ->getCollection(); foreach ($products as $product) { print $product->getCategory()->getName(); print $product->getName(); }
38. Which of the following will call a static block inside one of Magento's template files?
Answers:
• $this->setBlockId('my_static_block_name')->toHtml()
• $this->getLayout()->createBlock('cms/block')->setBlockId('my_static_block_name')->toHtml()
• $this->createBlock('cms/block')->setBlockId('my_static_block_name')->toHtml()
• $this->getLayout()->createBlock('cms/block')->BlockId('my_static_block_name')->toHtml()
39. Which of the following Magento objects will be created during checkout?
Answers:
• sales/payment
• sales/tax
• sales/order
• sales/quote
40. Assuming the following choices are to be added to a custom theme layout's local.xml file; which of the following will move the "related products" box in the "product details page" to the bottom center column?
Answers:
• <catalog_product_view> <reference name="right"> <action method="unsetChild"> <block>catalog.product.related</block> </action> </reference> <reference name="content"> <action method="insert"> <block>catalog.product.related</block> </action> </reference> </catalog_product_view>
• <catalog_product_view> <reference name="right"> <action method="unsetChild"> <block>catalog.product.related</block> </action> </reference> <reference name="product.info"> <action method="insert"> <block>catalog.product.related</block> <after>1</after> </action> </reference> </catalog_product_view>
• <catalog_product_view> <reference name="right"> <action method="unsetChild"> <block>catalog.product.related</block> </action> </reference> <reference name="product.info"> <action method="insert"> <block>catalog.product.related</block> <after>0</after> </action> </reference> </catalog_product_view>
• None of the above.
41. What is the correct method to add an external JavaScript file to Magento's local.xml file?
Answers:
• <action method="addScript"><script>jquery/jquery.js</script></action>
• <action method="addCss"><script>jquery/jquery.js</script></action>
• <action method="addJS"><script>jquery/jquery.js</script></action>
• None of the above
42. Which of the following will check whether the currently logged-in customer ever placed an order at the Magento store?
Answers:
• $order = Mage::getModel('sales/order')->getCollection() ->addAttributeToFilter('customer_id',$session->getId()) ->getFirstItem(); if ($orders->getSizeValue()) { }
• $orders = Mage::getResourceModel('sales/order_collection') ->addFieldToSelect('*') ->addFieldToFilter('entity_id', $customer->getEntityId()); if ($orders->getSize()) { }
• $orders = Mage::getResourceModel('sales/order_collection') ->addFieldToFilter('customer_id', $customer->getId()); if ($orders->getValue()) { }
• $orders = Mage::getResourceModel('sales/order_collection') ->addFieldToSelect('*') ->addFieldToFilter('customer_id', $customer->getId()); if ($orders->getSize()) { }
43. How can a new column be added in sales_flat_order to save a custom value in Magento?
Answers:
• By adding column name in Model
• By adding column name in Controller
• By adding column name in Block
• By defining column name in Block and table
44. Which of the following will get the order increment ID in Magento?
Answers:
• $order = Mage::getSingleton('sales/order')->getLastOrderId(); $lastOrderId = $order->getIncrementId();
• $orderId = $this->getOrderId();
• $order = Mage::getModel('sales/order'); $order->load(Mage::getSingleton('sales/order')->getLastOrderId()); $lastOrderId = $order->getIncrementId();
• None of these.
45. Which of the following will get the tax amount on a page in Magento?
Answers:
• Mage::helper('checkout')->getQuote()->getShippingAddress()->getData('tax_amount');
• $totalItemsInCart = Mage::helper(‘checkout/cart’)->getItemsCount(); $totals = Mage::getSingleton(‘checkout/session’)->getQuote()->getTotals(); $subtotal = round($totals["subtotal"]->getValue()); $grandtotal = round($totals["grand_total"]->getValue()); >if(isset($totals['discount']) && $totals['discount']->getValue()) { $discount = round($totals['discount']->getValue()); } else { $discount = ”; } if(isset($totals['tax']) && $totals['tax']->getValue()) { $tax = round($totals['tax']->getValue()); } else { $tax = ”; }
• $order = Mage::getModel('sales/order')->load($order_id); $items = $order->getAllItems(); $subtotals = array(); foreach ($items as $_item) { if (array_key_exists($subtotals[$_item->getTaxClassId()])) { $subtotals[$_item->getTaxClassId()] += $_item->getRowTotal(); } else { $subtotals[$_item->getTaxClassId()] = $_item->getRowTotal(); } }
• <?php $order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId()); $data = $order->getData(); ?>
46. Which of the following will retrieve a list of all shipping methods in Magento?
Answers:
• public function toOptionArray($isMultiSelect = false) { $methods = Mage::getSingleton('shipping/config')->getActiveCarriers(); $options = array(); foreach($methods as $_code => $_method) { if(!$_title = Mage::getStoreConfig("carriers/$_code/title")) $_title = $_code; $options[] = array('value' => $_code, 'label' => $_title . " ($_code)"); } if($isMultiSelect) { array_unshift($options, array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('--Please Select--'))); } return $options; }
• $salesQuoteRate = Mage::getModel('sales/quote_address_rate')->load($rate_id); if($salesQuoteRate){ echo '<br/>CODE : '.$salesQuoteRate->getCode(); echo '<br/>METHOD : '.$salesQuoteRate->getMethod(); }
• $iOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId(); $oOrder = Mage::getModel('sales/order')->loadByIncrementId($iOrderId); echo $oOrder->getShippingMethod(); echo $oOrder->getShippingDescription();
• echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingMethod();
47. Which of the following will list all products from a particular category?
Answers:
• $products = Mage::getModel('catalog/category')->load($category_id) ->getProductCollection() ->addAttributeToSelect('*') ->addAttributeToFilter('status', 1) ->addAttributeToFilter('visibility', 4) ->addAttributeToFilter('special_price', array('neq' => "")) ->setOrder('price', 'ASC') ;
• $productCollection = Mage::getResourceModel('catalog/product_collection') ->addCategoryFilter($category);
• $products = Mage::get(('catalog/category')->load($category_id) ->getCollection() ->addAttributeToSelect('*') ->addAttributeToFilter('status', 1) ->addAttributeToFilter('visibility', 4) ->addAttributeToFilter('special_price', array('neq' => "")) ->setOrder('price', 'ASC') ;
• $products = Mage::getModel('catalog/category')->load($category_id) ->getProduct() ->addAttributeToSelect('*') ->addAttributeToFilter('status', 1) ->addAttributeToFilter('visibility', 4) ->addFilter('special_price', array('neq' => "")) ->setOrder('price', 'ASC') ;
48. By default, Magento allows 3 themes to be loaded at any time. In what order are they loaded? (1 being first and 3 being last)
Answers:
• 1 Custom default theme 2 Magento base theme 3 Custom non-default theme
• 1 Magento base theme 2 Custom default theme 3 Custom non-default theme
• 1 Custom non-default theme 2 Custom default theme 3 Magento base theme
• None of the above
49. What is the correct method for calling a single product inside a static block?
Answers:
• {{block type="media/product_single" product_id="1" template="catalog/product/singleproduct.phtml"}}
• {{block type="catalog/product_single" product_id="1" template="catalog/product/singleproduct.phtml"}}
• {{block type="all/product_single" product_id="1" template="catalog/product/singleproduct.phtml"}}
• {{block type="categories/product_single" product_id="1" template="catalog/product/singleproduct.phtml"}}
50. Which of the following code samples will link a configurable product's images to its constituent simple products, in the product details page?
Answers:
• $_parentIdArray = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($_product->getId()); if(sizeof($_parentIdArray)==1 && Mage::getModel('catalog/product')->load($_parentIdArray[0])->getTypeId() == 'configurable'){ $_product = Mage::getModel('catalog/product')->load($_parentIdArray[0]); }
• $_childIdArray = Mage::getModel('catalog/product_type_configurable')->getChildIds($_product->getId()); if(sizeof($_childIdArray)==1 && Mage::getModel('catalog/product')->load($_childIdArray[0])->getTypeId() == 'configurable'){ $_product = Mage::getModel('catalog/product')->load($_childIdArray[0]); }
• $_parentIdArray = Mage::getModel('catalog/product')->getIdsByChild($_product->getId()); if(sizeof($_parentIdArray) >= 1 && Mage::getModel('catalog/product')->load($_parentIdArray[0])->getTypeId() == 'configurable'){ $_product = Mage::getModel('catalog/product')->load($_parentIdArray[0]); }
• $_childIdArray = Mage::getModel('catalog/product')->getChildIdsByParent($_product->getId()); if(sizeof($_childIdArray)==1 && Mage::getModel('catalog/product')->load($_childIdArray[0])->getTypeId() == 'configurable'){ $_product = Mage::getModel('catalog/product')->load($_childIdArray[0]); }