Exception printing is disabled by default for security reasons. Error log record number: XXXXXXXXXXXXXXX
Solution :
After installation of magento then some of pages shows this error.
Exception printing is disabled by default for security reasons. Error log record number: XXXXXXXXXXXXXXX
In this case you need to check following steps.
1) Go to folder /home/username/public_html/errors/ 2) cp -p local.xml.sample local.xml 3) vi /home/username/public_html/lib/Zend/Cache/Backend/File.php
and search
The list of countries in Magento doesn’t work like all other data
collections. Rather than store country data in the database, Magento
stores country data in an XML file and loads it in on each request.There were some simple functions we can use to access
country names and codes in Magento. In this post, I will guide you
through how to create a drop-down list of countries in Magento:
The above code will print out an array containing every country code and country name known to Magento.
Drop Downs and Country Information
The
most common reason developers access country names in Magento is to
create a drop down. There are several ways to accomplish this and they
differ depending on whether you’re in the admin (backend) or the
frontend.
Creating a Country Drop-Down in the Magento Frontend
You
can add the following code to any template file in the frontend of
Magento and you will get a drop down box using the country name as the
label and the country code as the value.
Creating a Country Drop Down in the Backend Magento Admin
When
creating forms in the Magento Admin area, it is very rare that we use
actual HTML. The reason for this is that forms are generally built using
pre-built functions. The benefit of this is that each Admin page looks
uniform and helps to keep Magento looking like one whole application
rather than having loads of bits stuck onto it. As our method of adding
HTML changes, so must our method of creating our country drop down.
Cross-selling is
the action or practice of selling among or between clients, markets,
traders, etc. or the action or practice of selling an additional product
or service to an existing customer. For Magento, products that are
offered as cross-sell will be automatically showed on the checkout cart
page before the customer start with their checkout process.
This tutorial shows you how to setup Cross Sell for your Magento store to increase sales.
To set up cross-sell products:
In the admin panel, select Product Information on the left and click Cross-sells.
Next, click the Reset Filter button in the upper-right to list
all the available products, or use the search filters at the top of each
column to find specific products.
In the product list, select the check-box of any product you want to feature as a cross-sell.
When finished, click the Save button.Now the selected products will be showed in Checkout Process as Cross Sell products.
To add Date Picker to Magento
admin backend configuration page. There is no direct model that can be
called to add the date picker. However, these simple steps will allow
you to add the date picker to back-end of your Magento site.
Step 1.
Edit system.xml, create the new field as follows:
<my_date translate="label comment">
<label>Expire On</label>
<frontend_type>text</frontend_type><!--Set the frontend type asText-->
Changing favicon of a magento site is very easy without
making any changes to code. Here were the steps to follow:
First method:
Go to System->configuration->Design
Under design open HTML Head Tab and upload your favicon ico and Click Save Config Button
Second Method:
To change the favicon ico in magento to paste your favicon ico instead of magento favicon ico (remove magento favicon ico and paste your favicon ico) in following folders
codePool is a tag which you have to specify when registering new module in app/etc/modules/Company_Module.xml
There are 3 codePools in Magento: core, community and local, which are resided at app/code/ directory.
Core codePool is used by Magento core team, Community is generally used
by 3rd party extensions and Local codePool should be used for in-hour
module development and overriding of core and community modules for
custom requirement.
So in short, codePool helps Magento to locate module inside app/code/ for processing.
EAV is entity attribute value database model, where data is fully in
normalized form. Each column data value is stored in their respective
data type table. Example, for a product, product ID is stored in
catalog_product_entity_int table, product name in
catalog_product_entity_varchar, product price in
catalog_product_entity_decimal, product created date in
catalog_product_entity_datetime and product description in
catalog_product_entity_text table. EAV is complex as it joins 5-6 tables
even if you want to get just one product’s details. Columns are called
attributes in EAV.
Flat model uses just one table, so it’s not normalized and uses more
database space. It clears the EAV overhead, but not good for dynamic
requirements where you may have to add more columns in database table in
future. It’s good when comes to performance, as it will only require
one query to load whole product instead of joining 5-6 tables to get
just one product’s details. Columns are called fields in flat model.
Magento creates 6 tables when you create new EAV module. Tables: module,
module_datetime, module_decimal, module_int, module_text and
module_varchar. one is the main entity table, and rest 5 tables which
holds attribute’s data in different data types. So that integer values
will go to module_int table, price values to module_decimal, etc.
Customer sessions stores data related to customer, checkout session
stores data related to quote and order. They are actuall under one
session in an array. So firstname in customer/session will be
$_SESSION['customer']['firstname'] and cart items count in
checkout/session will be $_SESSION['checkout']['items_count']. The
reason Magento uses session types separately is because once the order
gets placed, the checkout session data information should get flushed
which can be easily done by just unsetting $_SESSION['checkout'] session
variable. So that the session is not cleared, just session data
containing checkout information is cleared and rest all the session
types are still intact.
Commonly used block types: core/template, page/html, page/html_head,
page/html_header, page/template_links, core/text_list,
page/html_wrapper, page/html_breadcrumbs, page/html_footer,
core/messages, page/switch.
Some blocks like content, left, right etc. are of type core/text_list.
When these blocks are rendered, all their child blocks are rendered
automatically without the need to call getChildHtml() method.
In order to configure tier pricing please follow the steps below:
1. Log in to the Magento admin panel and open the product configuration page.
2. In the “Prices” tab you can see the “Tier Price” section. Tier
prices are used for those customers who are willing to order multiple
products and you want to reward them by giving a discount. Once you’ve
added the tier price, you can select the customer group that the price
will be valid for.
3. Set the website, the quantity of products and a new price.
Hello Magento lovers!, have you ever wanted to display New products
in your store by just setting the product “Set Product as New from Date”
within the product configuration in your Admin-panel?. It simple,
luckily Magento provides php functions to do almost anything you wish,
in this case we’ll use the
Mage::getResourceModel(‘catalog/product_collection’) features:
We’ll create a template file called: new_products.phtml
The content would be:
It is rather inconvenient to manually add a large number of products
at once to a Magento installation. Inserting products one by one will
take a long time especially when you have hundreds or thousands of
products.In such cases you need an automatic way to add all those
products to your Magento online store. We will address all steps you
need to take in order to achieve a successful import.
First, access your Magento administrator backend and go to Catalog -> Manage Categories.
Create all product categories you will need. You can do so by filling the form displayed below:
When you fill the form with all the information you like click the Save Category button.
Bear in mind that at this point you should make note of the newly
created category ids. It would be best to save them in a simple text
file as you will need them for the import. The category ID will be
displayed upon saving the category. It is recommended to make notes as
shown below
If you plan to have additional attributes for the products you are importing you will need to create those via Catalog ->Attributes ->Manage Attributes -> Add new Attribute.
You can use this functionality to add all custom attributes that are
not present by default in a standard Magento installation. Note also
that you can add additional attributes later at the moment you are
creating a sample product. It is up to you whether to create the
attributes before that or at the point you are creating the first
product.
The next step is to manually add a product to your Magento
installation. You will later export this product and use it as a
template for importing the large batch. Make sure you include all
attributes you will use for the products you are going to import in the
sample product. You might want to delete all default products that might
be present as you will not need them and then create the new product
you will use as a template for the import.
Once you create the new product and save it it will appear in the products list for your Magento store.
You are now ready to make the sample export that you will use as a template. In the Magento administrator area go to System -> Import/Export -> Dataflow – Profiles -> Export All Products. Under Profile Information -> Store
choose the desired store where you will be importing the products. This
should also match the store where you have previously created a sample
product. Under Data Transfer drop down menu choose Local/Remote Server. Under Data Format make sure CSV / Tab Separated is selected for type and click Save Profile. Then click export all products again and click Run Profile in Popup.
This will save a file named “export_all_products.csv” under the
var/export/ directory for your Magento installation. The export success
screen will look like this and will specify the file name where the
products were exported.
Using an FTP client
download this file to your local computer. The file will include
columns for each of the attributes you have defined for your products.
Open it in a spreadsheet program (MS Excel, Open Office Spreadsheet) and
add the products you would like to import. Make sure you are
copy/pasting the corresponding attributes in the correct columns. Also
here is when you will have to add the category IDs. Use the IDs from the
text file you saved earlier and put the corresponding category ID for
the products you are adding.
Once you have accomplished the above go back to the Magento administrator area and choose System -> Import/Export -> Dataflow – Profiles -> Import All Products.
Then choose Upload file and browse for the .csv file that you have
updated with the products that need to be imported. Once you have
uploaded it click Import All Products again, then Run Profile, select
the .csv file you have just uploaded from the drop down menu and click
Run Profile in Popup. A status screen will open and the products will
start importing
When the import completes you will get an export success message.
You can now go to the products section of the Magento administrator
backend and check the imported products. They will be present there and
assigned to the corresponding categories with the attributes you have
added for them.
In order to manage your web site pages you need to navigate to the CMS section in the Magento admin area. Click on the Manage Pages link in order to proceed with the pages modification.
You can edit a page by clicking on it. The Edit Page will open the window below:
You can modify this page to your preference. Static blocks
is another useful option. For example, you can edit the footer block
which contains the links located at the bottom of your main page:
The Polls section allows you to create and edit polls:
Actually, magento has a fully-featured CMS system integrated in it.
Browse through the pages to see the different elements you can add to
your site.
Step1
First goto “app\design\frontend\default\[your theme directory]\template\page”
make a copy of your template page it can be “1column.phtml” or “2columns-right.phtml”…. whatever you are using.
rename it to “restricted.phtml” and paste the below code just after body tag starts.
<?php <code>$login</code> <code>= Mage::getSingleton( </code><code>'customer/session'</code> <code>)->isLoggedIn(); </code><code>//Check if User is Logged In</code>
<div><code> </code><code>$msg</code> <code>= Mage::getSingleton(</code><code>'core/session'</code><code>)->addError(</code><code>$this</code><code>->__(</code><code>'Please Sign in / Register first to access this page.'</code><code>));</code></div>
Now open you “admin” ,” cms” and “add new page”
and you will find new select option under “design” tab in “Layout” option.
just select “Only Restricted/ sign in user”. Rest will be handelled by the code
I feel the “Log In”-link in the header is waste of space as the “My
Account”-link on the left side in the same area does the trick pretty
ok, but I havent figured out how to remove it from the loop in the code
which generated those toplinks.
I would need to add a “Logout”-box in the “My Account” area if this
was to be removed, or place a “Logout”-link somewhere else, but guess
that wont be any problem.
You have to go to app/design/frontend/default/default/layout/customer.xml.
Remove the action method :
Magento includes contact form functionality by default. A link to a
contact form can usually be found in the footer of your Magento
installation.
Of course, you can add a contact form on any page. All you need to do is: Log in to the administrator area.
Go to CMS > Pages.
Select the page you want to edit or create a new page.
Paste the following code using the HTML option of the WYSIWYG editor:
<!– CONTACT FORM CODE BEGIN–>
{{block type='core/template' name='contactForm' template='contacts/form.phtml'}}
<!– CONTACT FORM CODE END–>
Save the changes and the contact form will appear on the desired page.
In Magento Config.xml file is used to setup the module details. We used to setup config.xml file in PackageName/ModuleName/etc/.
Magento collect all the config data from different modules and combine it all into a single file named config.xml.
To view this file simply paste this code in any controllers, run it and see the magic. A huge tree with lots of nodes.
Once on the Onepage Checkout page, I need to track if the customer
has used any specific coupon code. This can be checked by the checkout
session.
Use this code to hunt up the coupon code. This code will return the coupon code if used or empty result.
Magento’s $this->getBaseUrl() method works inside template and blocks
only but not in the controllers because it’s a Core_Block class method.
To get the base url inside controller use instead this method.
In Magento modules, system.xml file is used to create admin
configuration tabs and options. Magento’s great feature allows
developers to create advanced configurable modules in a little time. At
the run time Magento collects all the xml files and group them into a
single file.
To view the system.xml file simply paste this code snippet in any controllers and run it. A large xml will be open.
Removing or Adding top links in the header section of the theme is
very easy via Layout.xml files. However we need to edit multiple files
to accomplish this task like wishlist.xml, customer.xml, checkout.xml
etc.
1. To Remove Wishlist link from top links
—————————————————————————–
Open the file /app/design/frontend/package/theme/layout/wishlist.xml and find the lines given below, simply comment these lines to remove the wishlist link.
2. To remove My Account link
—————————————————————————————
Open the file /app/design/frontend/package/theme/layout/customer.xml and find the lines and comment these lines.
3. Add Home Link in top menu
—————————————————————————————-
Open the file /app/design/frontend/package/theme/layout/customer.xml and search the line
‘’
Under the ‘’ add these lines.
4. To Remove or Add Checkout and My Cart link in top menu
———————————————————————————————
To show or hide the Checkout and My Cart link in the top links just comment or un-comment these lines in /app/design/frontend/package/theme/layout/checkout.xml file.
I had to display all the child categories products of the root
category on a page with filtered navigation on the left column, but by
default Magento does not display the root category products.
After some search and research I find the solution for this. It can
be accomplished using Layout Update XML inside the CMS page. Not only
layered nav but toolbar will also be displayed. For this we need to
create a new CMS page or we can use any existing page where we want to
display the products of the root category with filtered nav.
Follow steps:
1. Open Manage Category page in admin and choose the root category you want to display. Make sure that the category is Active and Is Anchor yes. Note down the category id.
2. Create a new CMS page, CMS > Pages > Add New Page or Edit any existing one where you want to display the products.
3. Fill the proper information in the required fields.
4. Under Design tab, paste the given code in the Page Layout > Layout Update XML textarea.
5. In the code find “category_id 3 category_id” and change your category id with 3. For example your category id is “2″ so it should be “category_id 2 category_id“.
6. Select the Layout 1, 2 or 3 columns whatever you want.
7. Note: I used reference name=”left” so layered nav will display only if 2columns with left bar is selected. If you want the right side column than change reference name=”left” to reference name=”right”.