I had written some code using Magento API, it worked fine on my local machine but when I transferred the same code to my linux server I got the following error:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://mydomain.com/api/soap/?wsdl=1' : failed to load external entity "http://mydomain.com/api/soap/?wsdl=1"
When I opened the URL ‘http://mydomain.com/api/soap/?wsdl=1’ directlty in my browser, it displayed the wsdl file as expected.
Indexes are needed to improve the performance of SELECT queries. They can be defined with table creation and also created after table creation with CREATE INDEX and ALTER TABLE statements. If during optimization you find that an index is not useful then you can DROP them using DROP INDEX or ALTER TABLE statements.
Indexes are needed to improve the performance of SELECT queries. Indexes in Mysql are just like the indexes available in books. Without indexes if we have to look for a topic in a book then we will have to go through each page content but luckily we have an index, we find the page number from the index and then open that page directly. Similarly in MySql if we have to find row(s) have a particular column value then without index on that column MySql will have to scan each row of the table to find the matching rows.
It is highly recommended that you create indices on columns of a table from which you often query the data.
Are you trying to import a MySql dump file and getting the following error: “#1452 – Cannot add or update a child row: a foreign key constraint fails”? Its because of the foreign key validation checks.
You can run the following statement to get detailed error information:
SHOW ENGINE INNODB STATUS;
Magento provides RSS feed for low inventory alerts. Lets us discuss how to subscribe to the feed.
First we need to set up the inventory level of a product at which it will be considered as low stock.
The file type for JSON files is “.json” and MIME type for JSON text is “application/json“.
Here are the characteristics of JSON:
In one of our projects, the requirement was to have a different layout for some category pages. So, we decided to use a different template file for these categories. We added the following code in the “Custom Layout Update” field for these categories in admin.
<reference name="category.products"> <action method="setTemplate"> <template>catalog/category/custom-category.phtml</template> </action> </reference>
These category pages need to show the products in a different layout.
In Magento you can create CMS static block from Admin by following the path: Admin >> CMS >> Static Blocks.
Lets see how we can display them on the frontend.
1. Using Layout updates
You can add layout updates in local.xml file for a page as shown below:
<reference name="right"> <block type="cms/block" name="your_block_name" before="-"> <action method="setBlockId"> <block_id>your_block_identifier</block_id> </action> </block> </reference>
You can enter these layout updates in Magento admin also – Categories, Products, CMS Pages provide a field for “Custom Layout Update”.
In Magento you can set the position of the products in a category from Magento admin by following the path Admin >> Catalog >> Categories >> Manage Categories >> Edit a category >> Set the position of the products in the “Category Products” tab.
Let see how we can find the position of a product on the product detail page:
$catId = Mage::registry('current_product')->getCategoryId(); $category = Mage::getModel('catalog/category')->load($catId); $productPositions = Mage::getResourceModel('catalog/category')->getProductsPosition($category); // This returns all product ids with their position echo $productPositions[$_product->getId()]; //Print the product postion
If you need to set data in a block so that you can use it in the block view file then you can do it in the layout xml files or in Magento admin using the Layout Update XML/Custom Layout Update XML field.
Suppose you want to differentiate a category based on a variable “category_type”, if the value of “category_type” is “sale” then you will display category image else not on the category landing page.
Navigate to Admin >> Catalog >> Categories >> Manage Categories. Click on the category that you want to mark as a “sale” category to edit it. We assume that “Is Anchor” is set as “Yes” for the category in the “Display Settings” tab.