1. Which of the following will display a customer’s TAX/VAT number?
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
<block type=”A/B” name=”root” output=”toHtml” template=”example/view.phtml”>
What is the meaning of A/B?
Answers:
Answers:
Answers:
Answers:
Answers:
“PHP Extensions “0” must be loaded”
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
<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:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
<block type=”” name=”left” as=”left” template=”page/html/left.phtml” />
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
All I know is that one of them is being set in Mage_Core_Model_Cookie::set(..) and the other one in Zend_Session::expireSessionCookie().
Why does Magento use the Zend_Session::expireSessionCookie()?
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
A. By default Magento store the Contact form data in database
B. Need to create a custom module which store data in database by override the core contacts module
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
Answers:
- $taxvat = $order[‘customer_taxvat’];
- $order->getData(‘customer_taxvat’);
- $order->getQuote()->getCustomerTaxvat();
- $order->getData()->getCustomerTaxvat();
Answers:
- There is an error in the code.
- Some modules failed to load.
- Router references were set incorrectly.
- .htacces is blocking URLs.
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.
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.
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();
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.
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; } }
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]
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
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.
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() ?>” />
<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”
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.
Answers:
- Mage::helper(‘core/http’)->getHttpUserAgent()
- Mage::helper(‘core/mage’)->getHttpUserAgent()
- Mage::helper(‘core/mage’)->getHttpAgent()
- Mage::helper(‘core/http’)->getHttpUserServer()
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.
Answers:
- Mage::registerEvent
- Mage::dispatchEvent
- Mage::addAction
- Mage::registerObserverEvent
“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
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.
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.
Answers:
- Mage::app()->getStore();
- Mage::app()->getStoreId();
- Mage::app()->getName();
- None of the above
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;
Answers:
- Processing state
- Payment Processing state
- Pending shipment state
- Payment Review state
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
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.
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.
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.
Answers:
- at least 128MB
- at least 256MB
- at least 512MB
- over 512MB
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.
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.
Answers:
- Database table ‘core_config_data’
- config.inc file at magento root
- app/etc/config.xml
- app/etc/local.xml
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);
<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”);
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
Answers:
- Method
- Class
- Event
- None of these.
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.
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);
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(); }
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()
Answers:
- sales/payment
- sales/tax
- sales/order
- sales/quote
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.
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
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()) { }
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
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.
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(); ?>
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();
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’) ;
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
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”}}
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]); }
Answers:
- <reference name=”product.info”> <block type=”mymodule/folder_class” name=”mymodule.folder.class” template=”mymodule/folder/class.phtml” as=”mymodule_folder_class”></block> </reference>
- <reference name=”product.info”> <block type=”mymodule/folder_class” after=”media” name=”mymodule.folder.class” template=”mymodule/folder/class.phtml” as=”mymodule_folder_class”></block> </reference> <?php echo $this->getChildHtml(‘mymodule_folder_class’);?>
- <reference name=”product.info”> <block type=”mymodule/folder_class” after=”media” name=”mymodule.folder.class” template=”mymodule/folder/class.phtml” as=”mymodule_folder_class”></block> </reference> <?php echo $this->getChildHtml(‘mymodule_class’);?>
- None of the above.
Answers:
- Using XML layout files
- By creating a new field in the database table named ‘catalog_attributes’
- Via the Magento Admin panel (Manage Attributes)
- By creating a new module
<block type=”” name=”left” as=”left” template=”page/html/left.phtml” />
Answers:
- catalog/navigation
- core/text_list
- page/template_container
- page/html
Answers:
- isAvailable() is used to decide whether to show an “Add to Cart” button or not, while isSaleable() is used to decide whether to display the product as “in stock” or “out of stock”.
- There is no difference between the two functions.
- isSaleable() checks if the product’s type can be sold, while isAvailable() checks if the product itself can be sold.
- isAvailable() is used to decide whether to display the product as “in stock” or “out of stock”, while isSaleable() is used to decide whether to show an “Add to Cart” button or not.
Answers:
- Mage_Sales_Model_Quote_Item_Option
- Mage_Sales_Model_Quote_Address_Total_Abstract
- Mage_Sales_Model_Quote_Item
- Mage_Sales_Model_Quote_Payment
Answers:
- Product visibility must be “Listed”;
- Product must be enabled;
- Stock and quantity must be greater than 0;
- If using multiple websites, check which website the product points to;
Answers:
- By re-indexing
- By using the following codes: Mage::register(‘product’, $product); Mage::register(‘current_product’, $product); $product->setCanSaveConfigurableAttributes(false); $product->setCanSaveCustomOptions(true);
- By using the following: 1. setBundleOptionsData() 2. setBundleSelectionsData() 3. setCanSaveBundleSelections(true)
- It is not possible to show programmatically added bundle products in the front-end.
Answers:
- $product->hasCustomType();
- $product->hasCustomOptions();
- $product->hasOptions();
- $product->hasOptionsType();
Answers:
- checkout_onepage_controller_success_action
- checkout_payment_confirmed
- sales_order_payment_pay
- payment_confirmed_action
Answers:
- Custom options are only stored on the quote as option IDs and values.
- Every time the options are rendered, they are reloaded from the database.
- If the values for custom options are modified, they would need to be saved, and that will set them for all users.
- None of these.
Answers:
- Mage::getResourceModel(‘catalog/product’)->getAttributeRawValue($productId, ‘attribute_code’, $storeId);
- $product->getResource()->getAttribute($attribute_code)->getFrontend()->getValue($product);
- $object->getData($this->getAttribute()->getAttributeCode());
- None of the above
Answers:
- $_productCollection = $this ->getLoadedProductCollection() ->addAttributeToFilter(‘type_id’,’configurable’);
- <?php if($_product->getTypeId() == “configurable”): ?> <?php $_configurable = $_product->getTypeInstance()->getUsedProductIds(); ?> <?php foreach ($_configurable as $_config): ?> <?php $_simpleproduct = Mage::getModel(‘catalog/product’)->load($_config); ?> <?php //Magic php with a $_simpleproduct. ?> <?php endforeach; ?> <?php endif; ?>
- $_productCollection = $this->getLoadedProductCollection(); foreach ($_productCollection as $_product) { if ($_product->_data[‘type_id’] == ‘configurable’) { … } }
- $collectionConfigurable = Mage::getResourceModel(‘catalog/product_collection’) ->addAttributeToFilter(‘type_id’, array(‘eq’ => ‘configurable’));
Answers:
- A) echo $_product->getImageUrl();
- B) echo $_product->getImagePath();
- C) Both A and B
- D) None of the above
Answers:
- app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Layout.php
- app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Grid.php
- app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Design.php
- A custom column cannot be added under Catalog >> Manage Products.
Answers:
- setBundleOptionsData, setBundleSelectionsData, setCanSaveBundleSelections, setAffectBundleProductSelections
- setBundleOptionsData,setCanSaveBundleSelections,setBundleSelectionsData,setAffectBundleProductSelections
- setBundleOptionsData, setBundleSelectionsData, setAffectBundleProductSelections, saveBundleOptions
- setBundleOptionsData, setCanSaveBundleSelections,setSelectionCollection, setAffectBundleProductSelections
Answers:
- $_productCollection = Mage::getResourceModel(‘catalog/product_collection’); Mage::getModel(‘catalog/layer’)->prepareProductCollection($_productCollection); $_productCollection->getSelect()->order(‘rand()’);
- $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSort() ->addAttributeToSelect(‘*”) ->addCategoryFilter(Mage::getModel(‘catalog/category’)->load()); $products->getSelect()->order(new Zend_Db_Expr(‘RAND()’));
- $products = Mage::getModel(‘catalog/product’) ->getCollection() ->addAttributeToSort(‘id’, ‘RAND()’) ->addAttributeToSelect(‘small_image’) ->addCategoryFilter(Mage::getModel(‘catalog/category’) ->load($catId));
- $_productCollection = Mage::getResourceModel(‘catalog/product_collection’); Mage::getModel(‘catalog/layer’)->prepareProductCollection($_productCollection); $_productCollection->getSelect()->rand();
All I know is that one of them is being set in Mage_Core_Model_Cookie::set(..) and the other one in Zend_Session::expireSessionCookie().
Why does Magento use the Zend_Session::expireSessionCookie()?
Answers:
- Because it is necessary for magento and you must use that session.
- Because Magento relies heavily on the Zend Framework as the underpinning and it will be able to be ignored.
- Because Magento relies heavily on the Zend Framework as the underpinning and I must use that for frontend session without condition.
- It is the vestigial code, so I was able to delete the Zend cookie without any apparent deleterious effects
Answers:
- <cms_index_index> <reference name=”content”> <block type=”cms/block” name=”home-page-block”> <action method=”setBlockId”><block_id>home-page-block</block_id></action> </block> </reference> <cms_index_index>
- <?php $ref = new Mage_Page_Block_Html_Header(); if($ref->getIsHomePage()){ ?> <?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘Your_StaticBlock_Id’)->toHtml();?> <?php } ?>
- <cms_index> <reference name=”content”> <block type=”cms/block” name=”home-page-block”> <action method=”setBlockId”><block_id>home-page-block</block_id></action> </block> </reference> <cms_index>
- <cms_index> <reference name=”homepage”> <block type=”cms/block” name=”home-page-block”> <action method=”setBlockId”><block_id>home-page-block</block_id></action> </block> </reference> <cms_index>
Answers:
- <MAGENTOROOT>/media/
- <MAGENTOROOT>/media/import/
- <MAGENTOROOT>/import/
- <MAGENTOURL>/
Answers:
- subdomain.domain.com needs to be entered in Magento’s Admin->System->Configuration->Web->Cookie Domain, to make session cookies available to other subdomains.
- subdomain.domain.com needs to be entered in Magento’s app/code/core/Mage/Core/Model/Config.php file, to make session cookies available to other subdomains.
- Allowing access to session cookies from other subdomains is not part of Magento’s core functionality, but it can be achieved using extensions.
- It is not possible to access a Magento site’s cookies on a different subdomain.
Answers:
- <?php require_once ‘app/Mage.php’; ini_set(‘display_errors’,true); Mage::setIsDeveloperMode(true); umask(0) ; Mage::app(); //get the admin session Mage::getSingleton(‘core/session’, array(‘name’=>’adminhtml’)); //verify if the user is logged in to the backend if(Mage::getSingleton(‘admin/session’)->isLoggedIn()){ echo “Admin Logged in with following details”.'<br>’; echo “Admin Username: – “.Mage::getSingleton(‘admin/session’)->getData(‘user’)->getUsername().'<br>’; echo “Admin Encrypted Password: – “.Mage::getSingleton(‘admin/session’)->getData(‘user’)->getPassword().'<br>’; } else { echo “You need to be logged in as an admin.”; } ?>
- <?php Mage::getSingleton(‘core/session’, array(‘name’=>’adminhtml’) ); $adminsession = Mage::getSingleton(‘admin/session’, array(‘name’=>’adminhtml’)); if($adminsession->isLoggedIn()) { echo “<br>”. “Admin Logged in”; } else { echo “<br>”. “Admin NOT logged in”; } ?>
- $sesId = isset($_COOKIE[‘adminhtml’]) ? $_COOKIE[‘adminhtml’] : false ; $session = false; if($sesId){ $session = Mage::getSingleton(‘core/resource_session’)->read($sesId); } $loggedIn = false; if($session) { if(stristr($session,’Mage_Admin_Model_User’)) { $loggedIn = true; } } var_dump($loggedIn);
- $userArray = Mage::getSingleton(‘admin/session’)->getData(); $user = Mage::getSingleton(‘admin/session’); echo $userId = $user->getUser()->getUserId(); echo $userEmail = $user->getUser()->getEmail(); echo $userFirstname = $user->getUser()->getFirstname(); echo $userLastname = $user->getUser()->getLastname(); echo $userUsername = $user->getUser()->getUsername(); echo $userPassword = $user->getUser()->getPassword();
Answers:
- <reference name=”head”> <action method=”addJs”><script>folder/file.js</script></action> </reference>
- <action method=”addJs”> <script>http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js</script> </action>
- <action method=”Jsadd”> <script>http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js</script> </action>
- <action method=”addJs”>http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js</action>
Answers:
- Newsletters
- Contact and Transactional Emails
- Poll
- All of above
Answers:
- It can not be done by using Magento’s MVC approach, but it can be done by emulating traditional PHP MVC behaviors.
- It can not be done by emulating traditional PHP MVC behaviors, but it can be done by using Magento’s MVC approach.
- It can be done by writing this code on a controller: Mage::transfer(‘data’, $data); and writing this in the block: $data = Mage::registry(‘data’);
- It can be done by writing this code on a controller: Mage::register(‘data’, $data); and writing this in the block: $data = Mage::registry(‘data’);
Answers:
- By using block syntax {{block type=”core/template” name=”contactForm” template=”contacts/form.phtml”}}
- By Using Layout Update <reference name=”content”> <block type=”core/template” name=”contactForm” template=”contacts/form.phtml”/> </reference>
- By Creating an Widget of Contact form and adding that widget to CMS page
- All of above is correct
Answers:
- Mage::app()->getStore()->isAdmin()
- Mage::code()->getStore()->isAdminArea()
- Mage::app()->getStore()->Admin()
- Mage::app()->getStore()->AdminHtml()
A. By default Magento store the Contact form data in database
B. Need to create a custom module which store data in database by override the core contacts module
Answers:
- Statement A is true and Statement B is false
- Statement B is true and Statement A is false
- Both statements are true.
- Both statements are false.
Answers:
- Sends an authorization request to the payment gateway’s API.
- Collects funds from the authorized transaction and puts it in the merchant’s account.
- Throws an exception when authorization has failed.
- Collects the order and makes the shipment.
Answers:
- app/etc/config.xml
- app/db/config.xml
- app/etc/local.xml
- app/code/core/db/local.xml
Answers:
- STATUS_SUBSCRIBED
- STATUS_NOT_ACTIVE
- STATUS_UNSUBSCRIBED
- All the above
Answers:
- Reducing the time spent on creation of the blocks
- Disabling the cache in the admin panel
- Switching on compiler mode
- Using auto-optimization extensions
Answers:
- Mage::getSingleton(‘core/design_package’)->getName();
- Mage::getDesignPackage()->getName();
- Mage::getSingleton(‘core/design_package’)->getTheme(‘frontend’);
- Mage::getSingleton(‘core/design_package’)->getName(‘package’);
No comments:
Post a Comment