tag:blogger.com,1999:blog-31937154976904864562024-03-23T03:13:16.956-07:00Magento - Crack the CodeAnonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.comBlogger22125tag:blogger.com,1999:blog-3193715497690486456.post-45059448017636191142012-12-14T02:45:00.002-08:002012-12-14T02:51:54.703-08:00Wishlist with wished features - Add items into wishlist with options and allow to add certain amount of items into wishlist box.<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
</div>
<br />
In Magento there is great features of wishlist for the users who don’t want to buy items at that time, as you all are aware about this features. But in Magento when we're going to add items into wishlist then it should just add it, no meter with its options.<br />
<br />
<b>I.E:</b><br />
When we add any product into shopping cart, it prompt error if we add it without options (for configurable, custom options products) but the same scenario is not happen with wishlist.<br />
<br />
As I customize as per demand of one my client and here is demo for it, have a look on below image which prompts users to choose options before adding into wishlist.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-5pQxFKyBsKo/UMsCSMr0GBI/AAAAAAAAATQ/pt57r0YZaWU/s1600/front_wishlist.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="http://2.bp.blogspot.com/-5pQxFKyBsKo/UMsCSMr0GBI/AAAAAAAAATQ/pt57r0YZaWU/s320/front_wishlist.png" width="320" /></a></div>
<br />
<br />
<br />
Another thing is, to prevent users to add certain amount of items into wishlist.. like say to set limitations to add certain amount of items into wishlist as per store wise. Here my customization is to define the number of items are allowed to add into wishlist box with custom message, If not specify then it allowed to add as many items as client want to add into wishlist.<br />
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-8XOD3D5nHXg/UMsCbNaHMCI/AAAAAAAAATY/I6cZ5ULVDMc/s1600/admin_wishlist-conf.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="http://3.bp.blogspot.com/-8XOD3D5nHXg/UMsCbNaHMCI/AAAAAAAAATY/I6cZ5ULVDMc/s320/admin_wishlist-conf.png" width="320" /></a></div>
<div>
<br /></div>
<div>
Prompt the message if users trying to add more items (As off here only 1 item is allowed to add, so when user try to add more items, it prompt the below error)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-d7PRRrO7Z6k/UMsEwaZzhzI/AAAAAAAAATg/W4ux-WsLuPg/s1600/front_error.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="http://4.bp.blogspot.com/-d7PRRrO7Z6k/UMsEwaZzhzI/AAAAAAAAATg/W4ux-WsLuPg/s320/front_error.png" width="320" /></a></div>
<br />
<br /></div>
<div>
<div>
At last with another small and but important features is that to send the notification email to both admin and customers when they add items into wishlist box.</div>
</div>
<div>
<br /></div>
<div>
Ping me for the extension, (best to email me)</div>
<div>
<br /></div>
<div>
Cheers,</div>
<div>
Gaurav</div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com19tag:blogger.com,1999:blog-3193715497690486456.post-86036790541386941782011-11-04T09:38:00.000-07:002011-12-01T09:46:50.044-08:00Magento Navigation menu of CMS pages<div dir="ltr" style="text-align: left;" trbidi="on">
Hi Buddy's,<br />
<br />
yeah, navigation menu of CMS pages.. As we aware Magento can provide us options to make the CMS pages,.also we can display it on front end. . but things is those who are non IT people want to do such task then??<br />
<br />
I have solution for it.. with Navigation menu of CMS pages.. Main point is, you don’t need of any developer /
programmer this functionality, and you can manage it by your own. By just single time installation or on one
click.<br />
<br />
<b>Backend configuration:</b><br />
Go on Menu: CMS >> Pages<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Add new CMS page over there, In general tab there is options
to select the status of “Show in Horizontal Menu”. If you “enabled” it then it
would be show on frontend, at anytime you can make it “enabled” or “disabled”
as per your need.</div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-YJdXEJVSlOQ/Tte8ZeMLQzI/AAAAAAAAAQM/U6EEErbQruw/s1600/hori-+admin.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="166" src="http://1.bp.blogspot.com/-YJdXEJVSlOQ/Tte8ZeMLQzI/AAAAAAAAAQM/U6EEErbQruw/s320/hori-+admin.png" width="320" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Here there is options to display on menu or not..</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b>Frontend view.</b></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-7D_XRApP3oQ/Tte8wvCKikI/AAAAAAAAAQU/TEiHqDxHqyI/s1600/hori-front.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="157" src="http://2.bp.blogspot.com/-7D_XRApP3oQ/Tte8wvCKikI/AAAAAAAAAQU/TEiHqDxHqyI/s320/hori-front.png" width="320" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
Currently, I enabled the “about us” and “customer service”,
so it display here.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
However here I display in Horizontal, of course it possible
to display in nay place as you want!</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Just simple things and big advantage of it.!!</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Thanks.!</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Warm Regards.</div>
<div class="MsoNormal">
Gaurav Mehta</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<br /></div>Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com79tag:blogger.com,1999:blog-3193715497690486456.post-83422371817931772082011-10-22T23:22:00.000-07:002011-10-22T23:22:29.997-07:00Magento Budget Box - Enter your budget and get all the items without breaking the bank.!!<div dir="ltr" style="text-align: left;" trbidi="on">
Dear Friends,<br />
<br />
Budget box, as per the name suggest user can enter their budget and will get all the items which they afford without breaking the bank.
Please see the following screen shot for how it look, (you need to design it as per your store design)
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-jCPQp1ccO9E/TqOvzfQ9wrI/AAAAAAAAANo/ZcNKm_uaWPk/s1600/1.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="196" src="http://4.bp.blogspot.com/-jCPQp1ccO9E/TqOvzfQ9wrI/AAAAAAAAANo/ZcNKm_uaWPk/s320/1.bmp" width="320" /></a></div>
<br />
How it Works;
Enter your budget amount and click on “search” button, result is on front of you.
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-HiqdmMNhmwg/TqOwMjDUSII/AAAAAAAAAN0/6NAbnf7-5gE/s1600/2.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="221" src="http://4.bp.blogspot.com/-HiqdmMNhmwg/TqOwMjDUSII/AAAAAAAAAN0/6NAbnf7-5gE/s320/2.bmp" width="320" /></a></div>
<br />
One more facility is there, it’s about the message.
You can set your own message, means you don’t need to take help of any developer if you want to change the message of title and change result.
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-8LT1DPXkxJ0/TqOwfqMFEMI/AAAAAAAAAOA/M14iGf6vy4c/s1600/3.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="196" src="http://1.bp.blogspot.com/-8LT1DPXkxJ0/TqOwfqMFEMI/AAAAAAAAAOA/M14iGf6vy4c/s320/3.bmp" width="320" /></a></div>
Which you seen in front end.
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-1DwWOyl1org/TqOwyj0vsXI/AAAAAAAAAOM/mdI_ATGwc84/s1600/4.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="196" src="http://3.bp.blogspot.com/-1DwWOyl1org/TqOwyj0vsXI/AAAAAAAAAOM/mdI_ATGwc84/s320/4.bmp" width="320" /></a></div>
<br />
And you done, let me know about your feedback, it would great for me.<br />
<br />
Cheers<br />
Gaurav
</div>Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com0tag:blogger.com,1999:blog-3193715497690486456.post-20706435852240261242011-10-07T10:44:00.000-07:002011-10-10T10:44:31.943-07:00Magento _ Products Disabled after reaching end date through cron<div dir="ltr" style="text-align: left;" trbidi="on">
Hello Dudes,<br />
<br />
As per title say, if you would like something after reaching the specific date; my products should be disabled... It would not longer seen after reaching date which is defined for that products. <br />
<br />
For that you just have to define the end date for that products, others things should be handle by the application code..<br />
<br />
<b>How it look/work.</b><br />
<br />
Define the end date for the product.<b> </b><br />
<b><br /></b><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-gIHPcwS8RZM/TpMuCGBrwiI/AAAAAAAAANc/YA9X-NPKKQ8/s1600/127.0.0.1+-+2011-10-10+-+11h.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="104" src="http://2.bp.blogspot.com/-gIHPcwS8RZM/TpMuCGBrwiI/AAAAAAAAANc/YA9X-NPKKQ8/s320/127.0.0.1+-+2011-10-10+-+11h.png" width="320" /></a></div>
<b><br /></b><br />
<br />
Now you just have to set the CRON on server when it would reach the end date of the products.. It would make it disabled.<br />
<br />
Let me know your feedback/ thoughts about the extension... it would be great for me.<br />
<br />
Let me know if want this extensions.<br />
<br />
Cheers,<br />
Gaurav.<br />
<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com13tag:blogger.com,1999:blog-3193715497690486456.post-25550315459275658412011-10-05T10:10:00.000-07:002011-10-10T10:28:23.697-07:00Magento - Mass Shipment Create<div dir="ltr" style="text-align: left;" trbidi="on">
Hello Dudes,<br />
<br />
If you feel that to create the shipment is time oriented like go on each order then create the shipment one by one then I have solutions for it through it you can create the mass shipment of your orders.<br />
<br />
You just have to select the orders then click on “mass Shipment creates” and shipment is created; same as you delete the multiple customers or change the status of products, etc…<br />
<br />
<b>How’s it look/work.</b><br />
<br />
As you seen I checked on some orders then go on Action tab and select the “mass Shipment creates” and click on “Submit” button and shipment(s) are created successfully.
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/--ybO-xhDd7M/TpMk6LW1cfI/AAAAAAAAANM/kODntm5xrfY/s1600/127.0.0.1%2B-%2B2011-10-10%2B-%2B11h-47m-24s.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="148" src="http://3.bp.blogspot.com/--ybO-xhDd7M/TpMk6LW1cfI/AAAAAAAAANM/kODntm5xrfY/s320/127.0.0.1%2B-%2B2011-10-10%2B-%2B11h-47m-24s.png" width="320" /></a></div>
<br />
The result after creating the mass shipment..<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-GIX2b9Am188/TpMlL0a81JI/AAAAAAAAANU/h3uyaZjH-VQ/s1600/127.0.0.1%2B-%2B2011-10-10%2B-%2B11h.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="163" src="http://1.bp.blogspot.com/-GIX2b9Am188/TpMlL0a81JI/AAAAAAAAANU/h3uyaZjH-VQ/s320/127.0.0.1%2B-%2B2011-10-10%2B-%2B11h.png" width="320" /> </a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
For now it is limited editions, means if you used shipment tracking system then it not more use full, I'm looking to upgrade this edition and would bring tracking system also in mass shipment create module.</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
Let me know about your feedback and your thoughts regarding this extension.</div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
PM me if you want this extension.</div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
Warm Regards,</div>
<div class="separator" style="clear: both; text-align: justify;">
Gaurav</div>
</div>
Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com4tag:blogger.com,1999:blog-3193715497690486456.post-10091546775292342812011-08-18T00:26:00.000-07:002011-08-18T00:28:16.199-07:00Integrity constraint violation when enabling/disabling Magento modules<div dir="ltr" style="text-align: left;" trbidi="on">Once i had one task which gave following error when enabled/disabled any module (System >> Configuration >> Advanced)<br />
<br />
Exception message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'default-0-advanced/modules_disable_output/<companyname>_<modulename>' for key 'config_scope'<br />
<br />
Solutions:<br />
First i think it may be because of dublicate entry of that module; so i was checked in "core_config_data", but i found nothing over there... there is no entry of that module in "core_config_data" table.<br />
<br />
So i execute the following query into mysql browser:<br />
<br />
INSERT INTO `core_config_data` (`scope`, `scope_id`, `path`, `value`) VALUES ('default', 0, 'advanced/modules_disable_output/Companyname_Modulename', 0);<br />
<br />
but it still through that error. then i checked into "config.xml" file of that module and what i found:<br />
<br />
There is problem of naming conversion. it is<br />
<br />
<pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh15m2oqMxuRaDms2wrv7I6YXsYINSJWxQz2l-v34N2hOv1yqdI3BzTPvGxb96bfxGbGfxIMS1UcBGtC2Gcuc7rRWmiA49MZENTqfRzzGpxqy3ds8svj2t0oZDccZXsPXf78svB3jSfkhqM/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"><code style="color:#000000;word-wrap:normal;"> <modules>
<<companyname>_<modulename>>
<version>0.1.0</version>
</<companyname>_<modulename>>
</modules>
Insted of
<modules>
<<Companyname>_<Modulename>>
<version>0.1.0</version>
</<Companyname>_<Modulename>>
</modules>
</code></pre><br />
First i delete the entry which i do for module install.<br />
I changed the capitalization in my config.xml file and check into the core_config_data table.. it added that module row with proper capitlization.<br />
Now it works fine<br />
<br />
Hope this will helps.<br />
<br />
Cheers <br />
Gaurav</modulename></companyname></modules></modulename></companyname></modules></modulename></companyname></div>Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com0tag:blogger.com,1999:blog-3193715497690486456.post-58010401056666805932011-06-30T03:32:00.000-07:002011-09-03T02:40:23.461-07:00Script for to remove the cache - Magento<div dir="ltr" style="text-align: left;" trbidi="on">
Here i paste code to remove the cache from the magento.. magento can provide a options to us to remove cache form the admin configuration, but sometimes it not more helpful to us... so expert suggest to remove cache folder..<br />
<br />
make one cache-clear.php file into your root folder and paste following code:<br />
<br />
<pre style="background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh15m2oqMxuRaDms2wrv7I6YXsYINSJWxQz2l-v34N2hOv1yqdI3BzTPvGxb96bfxGbGfxIMS1UcBGtC2Gcuc7rRWmiA49MZENTqfRzzGpxqy3ds8svj2t0oZDccZXsPXf78svB3jSfkhqM/s320/codebg.gif") repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> <?php
require_once ("app/Mage.php");
umask(0);
Mage::run();
Mage::app()->getCache()->clean();
exit("done");
?>
</code></pre>
<pre>can call that file with :http://yourdomainname/cache-clear.php</pre>
<pre></pre>
<pre>hope this helps :)</pre>
<pre></pre>
<pre>Cheers,</pre>
<pre>Gaurav</pre>
<pre></pre>
</div>
Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com0tag:blogger.com,1999:blog-3193715497690486456.post-74949546018887117262011-06-30T02:56:00.000-07:002011-09-03T02:40:47.201-07:00Could not determine temp directory, please specify a cache_die manually..after magento installed<div dir="ltr" style="text-align: left;" trbidi="on">
Hi guys,<br />
<br />
After magento is installed, you may have the error "Could not determine temp directory, please specify a cache_dir manually" when clicking on some pages.<br />
<br />
Usually it happened in shared web hosting, and on individual server it happened when the permission of tmp folder set wrong.<br />
<br />
Firstly, copy "/lib/Zend/Cache/Backend/File.php" to "/app/code/local/Zend/Cache/Backend/File.php", then in line 91:<br />
<pre>'cache_dir' => null,</pre>
<br />
change to<br />
<pre></pre>
<pre>'cache_dir' => "var/tmp/",</pre>
<br />
You can also change the cache folder wherever you want, and that directory you should create yourself and change the permission to 755.<br />
<br />
and you done :)<br />
Cheers,<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com6tag:blogger.com,1999:blog-3193715497690486456.post-88384241386005084382011-06-25T01:40:00.000-07:002011-09-03T02:44:04.735-07:00Magento Admin login problem<div dir="ltr" style="text-align: left;" trbidi="on">
I had a new installation of magento. But I was unable to login as an administrator. I went to the admin login page, entered correct username and password but was redirected to the same login page.<br />
Error message is displayed when I enter wrong username or password. But nothing is displayed and I am redirected to the same login page when I insert correct username and password.<br />
<br />
luckily i found solutions:<br />
<br />
The solution is to modify the core Magento code.<br />
Open <b>app/code/core/Mage/Core/Model/Session/Abstract/Varien.php</b>. Comment out the lines 80 to 83.<br />
The line number may vary according to the Magento version. But these lines are present somewhere near line 80. You have to comment the comma (,) in line:<br />
<pre style="background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh15m2oqMxuRaDms2wrv7I6YXsYINSJWxQz2l-v34N2hOv1yqdI3BzTPvGxb96bfxGbGfxIMS1UcBGtC2Gcuc7rRWmiA49MZENTqfRzzGpxqy3ds8svj2t0oZDccZXsPXf78svB3jSfkhqM/s320/codebg.gif") repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> $this->getCookie()->getPath()//,
// set session cookie params
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath()//,
//$this->getCookie()->getDomain(),
//$this->getCookie()->isSecure(),
//$this->getCookie()->getHttponly()
);
</code></pre>
<br />
In you have Magento 1.4 then you have to comment code from line 86 to 98,<br />
<pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh15m2oqMxuRaDms2wrv7I6YXsYINSJWxQz2l-v34N2hOv1yqdI3BzTPvGxb96bfxGbGfxIMS1UcBGtC2Gcuc7rRWmiA49MZENTqfRzzGpxqy3ds8svj2t0oZDccZXsPXf78svB3jSfkhqM/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"><code style="color:#000000;word-wrap:normal;"> /* if (!$cookieParams['httponly']) {
unset($cookieParams['httponly']);
if (!$cookieParams['secure']) {
unset($cookieParams['secure']);
if (!$cookieParams['domain']) {
unset($cookieParams['domain']);
}
}
}
if (isset($cookieParams['domain'])) {
$cookieParams['domain'] = $cookie->getDomain();
} */
</code></pre>
Well, This was solved my problem, hope, this solution you also...<br />
<br />
Cheers,<br />
Gaurav :) </div>
Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com67tag:blogger.com,1999:blog-3193715497690486456.post-10253545130384257542011-06-20T22:02:00.000-07:002011-09-05T22:44:59.225-07:00Magento Reindexing problem - take too long time<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
There are problem in reindexing in magento many times due to number of factors: <br />
<br />
<ul style="text-align: left;">
<li>The number of products</li>
<li>The number of store views</li>
<li>The apache/lighttpd timeout setting</li>
<li>The php.ini maximum execution time & script input time</li>
<li>The lock file is still place from the previous time can preventing it running again </li>
</ul>
<div style="text-align: left;">
</div>
one more thing VPS or dedicated server is must have for Magento.<br />
<br />
here i paste the trick/tips for the same.<br />
<br />
First of all increase your execution time value from the .htaccess<br />
<pre style="background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh15m2oqMxuRaDms2wrv7I6YXsYINSJWxQz2l-v34N2hOv1yqdI3BzTPvGxb96bfxGbGfxIMS1UcBGtC2Gcuc7rRWmiA49MZENTqfRzzGpxqy3ds8svj2t0oZDccZXsPXf78svB3jSfkhqM/s320/codebg.gif") repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> # php_value memory_limit 64M
php_value memory_limit 128M
php_value max_execution_time 18000
</code></pre>
Now open your shell/terminal:<br />
go on upto "public_html/app/shell"<br />
<br />
use "ls -l" command, to list out the files.<br />
there is one indexer.php file in the list.<br />
<br />
Commads:
<br />
<pre style="background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh15m2oqMxuRaDms2wrv7I6YXsYINSJWxQz2l-v34N2hOv1yqdI3BzTPvGxb96bfxGbGfxIMS1UcBGtC2Gcuc7rRWmiA49MZENTqfRzzGpxqy3ds8svj2t0oZDccZXsPXf78svB3jSfkhqM/s320/codebg.gif") repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> php indexer.php --info (Will shows list of allowed indexers)
php indexer.php --reindex all (Reindex data by all indexers)
</code></pre>
If you wish to reindex one by one then use following commands:
<br />
<pre style="background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh15m2oqMxuRaDms2wrv7I6YXsYINSJWxQz2l-v34N2hOv1yqdI3BzTPvGxb96bfxGbGfxIMS1UcBGtC2Gcuc7rRWmiA49MZENTqfRzzGpxqy3ds8svj2t0oZDccZXsPXf78svB3jSfkhqM/s320/codebg.gif") repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> php indexer.php --reindex catalog_product_attribute (Reindex Product Attribute)
php indexer.php --reindex catalog_product_price (Reindex Products prices)
</code></pre>
and so on.....<br />
<br />
If you don't have SSH (Command Prompt) access then try with following script;<br />
<pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh15m2oqMxuRaDms2wrv7I6YXsYINSJWxQz2l-v34N2hOv1yqdI3BzTPvGxb96bfxGbGfxIMS1UcBGtC2Gcuc7rRWmiA49MZENTqfRzzGpxqy3ds8svj2t0oZDccZXsPXf78svB3jSfkhqM/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"><code style="color:#000000;word-wrap:normal;"> <?php
require_once 'app/Mage.php';
$app = Mage::app('admin');
umask(0);
for ($index = 1; $index <= 8; $index++) {
$process = Mage::getModel('index/process')->load($index);
$process->reindexAll();
}
</code></pre>
Save file with reindex/php and run go on browser and run it like: http://yourdomainname/reindex.php<br />
<br />
Hope this helps,<br />
Do you have any tips? Post them in the comments and I'll add them to the list!<br />
<br />
Cheers :)</div>
Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com39tag:blogger.com,1999:blog-3193715497690486456.post-14690247995162769762011-05-12T03:05:00.000-07:002011-05-13T13:30:51.438-07:00Enable maintenance mode in magento<div dir="ltr" style="text-align: left;" trbidi="on">There is many times we need to put site into maintenance mode whenever you need to do any changes in the website<br />
Here i can show you how you can done this.<br />
<br />
For Magento version 1.4 and above:<br />
<br />
you just need to create a file named maintenance.flag in your Magento root. Then, your website automatically goes into maintenance mode and after completing your works you can comment or delete this file.<br />
<br />
If you want to edit some lines in maintenance template file.<br />
It is present in errors/default/503.phtml <br />
<br />
For Magento version 1.3 and below,<br />
- create a file called index.html in Magento root and write your maintenance messege in it,<br />
- write the following code in the beginning of index.php<br />
<br />
<?php<br />
// replace with your development IP<br />
if ($_SERVER['REMOTE_ADDR']!=='127.0.0.1') {<br />
header("Location: /index.html");<br />
exit;<br />
}<br />
<br />
Hope this help.!<br />
Cheers :) <br />
<br />
</div>Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com0tag:blogger.com,1999:blog-3193715497690486456.post-7762484572024718642011-05-04T02:27:00.000-07:002011-05-04T02:58:01.741-07:00PHP cURL functions<div dir="ltr" style="text-align: left;" trbidi="on">cURL is a library which allows you to connect and communicate to many different types of servers with many different types of protocols. it supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols.<br />
<br />
A typical PHP cURL, follows the following sequesnce:<br />
<b>curl_init –</b> Initializes the session and returns a cURL handle which can be passed to other cURL functions.<br />
<br />
<b>curl_opt – </b>This is the main work horse of cURL library. This function is called multiple times and specifies what we want the cURL library to do.<br />
<br />
<b>curl_close – </b>Closes the current cURL sessio <br />
<b>curl_exec –</b> Executes a cURL session.<br />
<br />
<b>Download file or web page using PHP cURL:</b><br />
<br />
<pre><?php</pre><pre>$ch = curl_init(); //Initialize the cURL session </pre><pre> </pre><pre>//Set the URL of the page or file to download.
</pre><pre>curl_setopt($ch,CURLOPT_URL,</pre><pre>'http://news.google.co.in/news?pz=1&cf=all&ned=in&hl=en&topic=t&output=rss' );</pre><pre>// Ask cURL to return the contents in a variable instead of simply echoing them to the browser.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec ($ch); //Execute the cURL session
print_r ($contents) // print the result
curl_close ($ch); //Close cURL session
?></pre><br />
As you can see, curl_setopt is used to Set an option for a cURL transfer.<br />
The above code uses two such options.<br />
<br />
<b>CURLOPT_URL:</b> Use it to specify the URL which you want to process. This could be the URL of the file you want to download or it could be the URL of the script to which you want to post some data.<br />
<br />
<b>CURLOPT_RETURNTRANSFER:</b> Setting this option to 1 will cause the curl_exec function to return the contents instead of echoing them to the browser.<br />
<br />
<b>Download file or web page using PHP cURL and save it to file:</b><br />
<pre><?php
$ch = curl_init();
curl_setopt($ch,
CURLOPT_URL,'http://news.google.co.in/news?pz=1&cf=all&ned=in&hl=en&topic=t&output=rss');
$fp = fopen('rss.xml', 'w'); //Create a new file
curl_setopt($ch, CURLOPT_FILE, $fp); // Ask cURL to write the contents to a file
curl_exec ($ch);
curl_close ($ch);
fclose($fp);
?>
</pre>here i used another function of cURL options that is<b> CUTLOPT_FILE :</b>- which Obtain a file handler by<br />
creating a new file or opening an existing one and then pass this file handler to the curl_set_opt<br />
function.<br />
<br />
<br />
Hope this will help.!<br />
<br />
Regards<br />
Gaurav :) <br />
<br />
</div>Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com1tag:blogger.com,1999:blog-3193715497690486456.post-70673062071331658742011-04-15T22:50:00.000-07:002011-06-30T23:07:17.815-07:00Display currency selection in header<div dir="ltr" style="text-align: left;" trbidi="on"><br />
By default, the currency selector is displayed in the left sidebar. Here, I will show you how you can show it in header.<br />
<br />
Create a new phtml file (../template/<dirname>/currency-top.phtml) and write the following code in it:<br />
<br />
<pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code><?php if($this->getCurrencyCount()>1): ?>
<div class="box language-switcher" style="margin-left:15px">
<label for="select-language">Your Currency: </label>
<select name="currency" onchange="changeCurrency(this)">
<?php foreach ($this->getCurrencies() as $_code => $_name): ?>
<option value="<?php echo $_code ?>"<?php if($_code==$this->getCurrentCurrencyCode()): ?> selected="selected"<?php endif; ?>>
<?php echo $_name ?> - <?php echo $_code ?>
</option>
<?php endforeach; ?>
</select>
</div>
<script type="text/javascript">
//<![CDATA[
function changeCurrency(sObject){
if(sObject.value){
setLocation('<?php echo $this->helper('directory/url')->getSwitchCurrencyUrl() ?>currency/'+sObject.value);
}
}
//]]>
</script>
<?php endif; ?>
</code></pre><br />
<br />
Now edit the <b> page.xml </b> file and add code of line into <b> HEADER </b> section:<br />
<br />
<code class="xml plain"></code><code class="xml keyword"><block></block></code> <code class="xml color1">type</code><code class="xml plain">=</code><code class="xml string">"directory/currency"</code> <code class="xml color1">name</code><code class="xml plain">=</code><code class="xml string">"currency_top"</code> <code class="xml color1">template</code><code class="xml plain">=</code><code class="xml string">"directory/currency-top.phtml"</code><code class="xml plain">/></code><br />
<code class="xml plain"> </code><block name="currency_top" template="directory/currency-top.phtml" type="directory/currency"> <br />
Edit <b> header.phtml </b> file and add following code:<br />
<br />
</block><br />
<div class="line number2 index1 alt1"><code class="php plain"><code class="php functions">echo</code> <code class="php variable">$this</code><code class="php plain">->getChildHtml(</code><code class="php string">'currency_top'</code><code class="php plain">) ?></code></code></div><block name="currency_top" template="directory/currency-top.phtml" type="directory/currency"> <br />
That’s all. Now, you will be able to see currency selector in the header of your site.<br />
<br />
Cheers, :)</block></div>Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com0tag:blogger.com,1999:blog-3193715497690486456.post-68880084402716652462011-04-06T02:22:00.000-07:002011-04-06T02:22:52.073-07:00By deafult selecting "Ship to this address" in billing section of checkout<div dir="ltr" style="text-align: left;" trbidi="on">Hi Guys,<br />
<br />
<br />
In Magento, by default there is selecting "Ship to different address" in billing section. If you want to selecting "Ship to this address" by default then, you can done this by following way.. .<br />
<br />
open the billing.phtml<br />
<br />
path: app/design/frontend/themename/themename/template/checkout/onepage/billing.phtml<br />
and put this before the <b> form tag </b><br />
<br />
$session = Mage::getSingleton('core/session');<br />
if (intval($session->getPreselectedAddressOption()) !== 1)<br />
{<br />
$session->setPreselectedAddressOption('1');<br />
$this->getQuote()->getShippingAddress()->setSameAsBilling(true);<br />
}<br />
<br />
In this way you make preselected "Ship to this address" in billing section of checkout.<br />
without modifying in core file.<br />
<br />
Cheers :)<br />
Gaurav</div>Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com0tag:blogger.com,1999:blog-3193715497690486456.post-53934427319738301752011-04-06T02:14:00.003-07:002011-04-06T02:14:32.545-07:00know, your server is compatible with Magento?<div dir="ltr" style="text-align: left;" trbidi="on">Hi guys,<br />
<br />
In order to run Magento your server needs to meet some basic software requirements but you can <b>test your server for compatibility</b> by following these simple steps:<br />
<br />
1. Download magento check file from hear: -<a href="http://www.magentocommerce.com/_media/magento-check.zip" mce_href="http://www.magentocommerce.com/_media/magento-check.zip">http://www.magentocommerce.com/_media/magento-check.zip</a><br />
2. Extract it and copy magento-check.php file into your directory (where your .htacces,index.php files are beside)<br />
3. In your browser navigate to this page:<br />
IE.<br />
<pre>magento/magento-check.php</pre><pre> </pre>Cheers,<br />
Gaurav :)</div>Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com0tag:blogger.com,1999:blog-3193715497690486456.post-91612408977002562822010-12-17T01:54:00.000-08:002010-12-17T01:54:27.799-08:00Avoid duplicate content on Google while your site accessible by both www/non-www URL<div class="post-content clear-block">Hey Guys,<br />
It has been issued about duplicate content as well as has Google Canonical problem when your site accessible both under your_domain.com and www.your_domain.com.<br />
<b>For ex.:</b><br />
<pre>www.example.com
example.com
www.example.com/index.html</pre><pre> </pre>The socking fact is that, these all are different URLs. From the search engine perspective, this can cause bit of an issue.<br />
To avoid such problems you can use the following lines in your .htaccess file,<br />
<b>For www version of your web:</b><br />
<pre> </pre><pre>RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.your_domain.com$
RewriteRule ^(.*)$ http://www.your_domain.com/$1 [R=301]</pre><b>For Non-www version of your web:</b><br />
<pre>RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.your_domain\.com$ [NC]
RewriteRule ^(.*)$ http://your_domain.com/$1 [R=301,L]</pre><b>Another Way is :</b><br />
By Canonical Tag:<br />
The Canonical Tag look like this:<br />
<link rel=”canonical” href=”http://www.example.com”/><br />
You have to simply add this tag inside (HEAD) section and also specify your preferred version of a URL.<br />
This is a great step to help cleaning up the Web of duplicate content.<br />
<br />
Best Regards :)<br />
Gaurav Mehta</div>Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com0tag:blogger.com,1999:blog-3193715497690486456.post-80923814259149734722010-12-11T01:26:00.000-08:002010-12-11T01:26:42.571-08:00Speed up Magento PerformanceBelow is the list of ways to speed up your Magento site. :)<br />
<br />
<br />
<strong><span style="text-decoration: underline;">Hosting Environment </span></strong><br />
<br />
Ø Host only those files that you have to use<br />
Ø Go to MySql Admin and select all the tables and repair and then optimize them<br />
Ø Use PHP Accelerator like APC, Zend optimizer , Xcache<br />
APC – <a href="http://pecl.php.net/package/APC" target="_blank"><code>http://pecl.php.net/package/APC</code></a><br />
Xcache – <a href="http://xcache.lighttpd.net/" target="_blank"><code>http://xcache.lighttpd.net/</code></a><br />
<div class="inner-sidebar"> </div> Note: By default magento stores its cache into file system<br />
You have to add following code into local.xml<br />
Path:-../<code>app/etc/local.xml</code><br />
<table border="1" cellpadding="0" cellspacing="0"><tbody>
<tr> <td valign="top" width="275"><global><br />
………………..<br />
<cache><br />
<backend>apc</backend><br />
<code><prefix>MAGE_</prefix></code><br />
</cache><br />
………………….</td> </tr>
</tbody> </table>After saved your changes, remember to refresh cache.<br />
<h3>Ø Enable GZIP/DEFLATE compression in .htaccess.</h3><ul><li>Go on this link and enter your magento site address. If it come back with <strong>green tick and say </strong><a href="http://yoursitename.com/"><strong>http://yoursitename.com</strong></a><strong> is gzipped</strong> then skip next step. If not then go on next step.</li>
<li>Find following lines in your .htaccess file and replace them with following code</li>
</ul><table border="1" cellpadding="0" cellspacing="0"><tbody>
<tr> <td valign="top" width="589"><IfModule mod_deflate.c> ############################################<br />
## enable apache served files compression<br />
## http://developer.yahoo.com/performance/rules.html#gzip<br />
# Insert filter on all content<br />
SetOutputFilter DEFLATE<br />
# Insert filter on selected content types only<br />
# Netscape 4.x has some problems…<br />
BrowserMatch ^Mozilla/4 gzip-only-text/html<br />
# Netscape 4.06-4.08 have some more problems<br />
BrowserMatch ^Mozilla/4\.0[678] no-gzip<br />
# MSIE masquerades as Netscape, but it is fine<br />
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html<br />
# Don’t compress images<br />
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary<br />
# Make sure proxies don’t deliver the wrong content<br />
Header append Vary User-Agent env=!dont-vary<br />
</IfModule></td> </tr>
</tbody> </table>Ø Use Apache mod_config and be sure to set how long these files should cached.<br />
Example for Apache virtual host config:<br />
<table align="left" border="1" cellpadding="0" cellspacing="0" style="width: 675px;"><tbody>
<tr> <td valign="top" width="675"># Turn on Expires and set default to 0 ExpiresActive On<br />
ExpiresDefault A0<br />
# Set up caching on media files for 1 year (forever?)<br />
ExpiresDefault A29030400<br />
Header append Cache-Control “public”<br />
# Set up caching on media files for 2 weeks<br />
ExpiresDefault A1209600<br />
Header append Cache-Control “public”<br />
# Set up 1 week caching on commonly updated files<br />
ExpiresDefault A604800<br />
Header append Cache-Control “proxy-revalidate”<br />
# Force no caching for dynamic files<br />
ExpiresActive Off<br />
Header set Cache-Control “private, no-cache, no-store, proxy-revalidate, no-transform”<br />
Header set Pragma “no-cache”</td> </tr>
</tbody> </table><strong><span style="text-decoration: underline;"> </span></strong><br />
<strong><span style="text-decoration: underline;"> </span></strong><br />
Ø Enabled Apache KeepAlives. Make sure your Apache configuration has KeepAlives enabled.<br />
<strong> </strong><br />
<ul><li>KeepAlives are a trick where multiple HTTP requests can be funneled through a single TCP connection. The setup of each TCP connection incurs additional time; this can significantly reduce the time it takes to download all the files (HTML, JavaScript, images) for a website.</li>
</ul>For more: <a href="http://httpd.apache.org/docs/2.2/mod/core.html#keepalive">http://httpd.apache.org/docs/2.2/mod/core.html#keepalive</a><br />
Ø Set ‘php_value memory_limit 128M’ in your PHP configuration or add it to your .htaccess file to ensure you don’t run out of memory.<br />
<br />
<table align="left" border="1" cellpadding="0" cellspacing="0"><tbody>
<tr> <td valign="top" width="243"><code>php_value memory_limit 128M</code></td> </tr>
</tbody> </table><br />
<br />
Ø Modify the configuration for your MySQL server to take better advantage of your server’s RAM<br />
<ul><li>Most Linux distributions provide a conservative MySQL package out of the box to ensure it will run on a wide array of hardware configurations. If you have ample RAM (e.g., 1 GB or more), then you may want to try tweaking the configuration. An example<strong> my.cnf</strong> is below, though you will want to consult the MySQL documentation for a complete list of configuration directives and recommended settings.</li>
</ul><table border="1" cellpadding="0" cellspacing="0"><tbody>
<tr> <td valign="top" width="386">key_buffer = 512M<br />
max_allowed_packet = 64M<br />
table_cache = 512<br />
sort_buffer_size = 4m<br />
read_buffer_size = 4m<br />
read_rnd_buffer_size = 2m<br />
myisam_sort_buffer_size = 64m<br />
tmp_table_size = 128m<br />
query_cache_size = 96m<br />
query_cache_type = 1<br />
thread_cache_size = 8<br />
max_connections = 400<br />
wait_timeout = 300</td> </tr>
</tbody> </table>Ø <strong>Speed up your Cache file:</strong><br />
Magento makes extensive use of file-based storage for caching and session storage. The slowest component in a server is the hard drive, so if you use a memory-based file system such as <strong>tmpfs</strong>, you can save all those extra disk IO cycles by storing these temporary files in memory instead of storing them on your slow hard drive.<br />
<strong> </strong><strong>Example:</strong><br />
Magento install is at <code>/var/www/yourdomain.com/</code> so your cache and session directories are <code>/var/www/yourdomain.com/var/cache/</code> and <code>/var/www/yourdomain.com/var/session/</code>For cache we will allocate a max of 256MB RAM and for sessions 64MB RAM. It is important to give access to everyone<br />
Please note, your <strong>tmpfs </strong>is temporary in sense nothing will be created on your hard drive. If you reboot, everything in <strong>tmpfs</strong> will be lost.<br />
Mount a <strong>tmpfs </strong>cache<br />
<table border="1" cellpadding="0" cellspacing="0" style="width: 613px;"><tbody>
<tr> <td valign="top" width="613">mount tmpfs /var/www/html/yourdomain.com/var/cache -t tmpfs -o size=64m mount tmpfs /var/www/html/yourdomain.com/var/session -t tmpfs -o size=64m</td> </tr>
</tbody> </table>For more space change 64m by any value (take care of your system RAM)<br />
Remember to restart apache.<br />
<strong><span style="text-decoration: underline;">Other Best way is:</span></strong><br />
Another option for the sessions is to save them in your database. Magento supports this very well and it is one small step to make this work. Just edit <code>app/etc/local.xml</code> and set<br />
<table border="1" cellpadding="0" cellspacing="0"><tbody>
<tr> <td valign="top" width="638"><session_save><![CDATA[files]]></session_save></td> </tr>
</tbody> </table>To<br />
<table border="1" cellpadding="0" cellspacing="0"><tbody>
<tr> <td valign="top" width="638"><session_save><![CDATA[db]]></session_save></td> </tr>
</tbody> </table>It will then save all sessions in the database which is a much quicker access than the filesystem. When you use a cluster enviroment you had to use this option.<br />
Ø Memcache your session<br />
Follow link: – <a href="http://www.magentocommerce.com/boards/viewthread/9037/">http://www.magentocommerce.com/boards/viewthread/9037/</a><br />
<br />
<strong><span style="text-decoration: underline;">Magento Configuration:</span></strong><br />
Ø Uninstall the extension that you don’t actually use<br />
Ø Enable all Magento Cache :- System/Cache Management<br />
Ø Combine “Java script” and “CSS” files :<br />
<code> System/ configuration -> Advanced -> Developer</code><br />
<code> </code><br />
“Java script settings” and “CSS settings”.<br />
You can also do this by using this extension: <a href="http://www.magentocommerce.com/magento-connect/FOOMAN/extension/457/fooman-speedster">Fooman Speedster extension</a><br />
Ø Use Magneto’s Compilation feature. It’s reported to give you a 25%-50% performance boost: <code><em>System > Tools > Compilation</em></code><em>.</em><br />
Ø Don’t use layered navigation if you don’t really need it, its resource intensive.<br />
Ø Use the correct session storage. The choice is either database or files and the best setup depends on your system setup so be sure to test which one works best for you<br />
<em>Ø </em>Disable the Magento log<em>: </em><code>System -> Configuration -> Advanced -> Developer -> Log Settings</code><em> (default is disabled)</em><em> </em><br />
Ø Set only those attribute frontend properties to ‘Yes’ that you’re actually going to use. Set all other to ‘No’. Don’t uses in quick search, advanced search compare, etc…<br />
<code><em>Catalog -> Attributes -> Manage Attributes -> Frontend Properties</em></code><br />
<br />
<code> </code><br />
<strong>Do me fever,</strong><br />
<strong>Do you have any tips? Post them in the comments and I’ll add them to the list!</strong><br />
<h4>Sources:</h4><a href="http://inchoo.net/">Inchoo</a> | <a href="http://www.yireo.com/tutorials/magento/magento-spo" target="_blank">Yireo.com | </a><a href="http://www.magentocommerce.com/boards/viewthread/193317/" target="_blank">Magentocommerce forum thread about these tips</a> | <a href="http://www.slideshare.net/dmitriysoroka/methods-and-best-practices-for-high-performance-ecommerce">Methods and Best Practices for High Performance eCommerce</a><br />
Regards :) <br />
Gaurav MehtaAnonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com6tag:blogger.com,1999:blog-3193715497690486456.post-54432593078196376702010-12-11T01:21:00.001-08:002010-12-11T01:21:18.306-08:00Take order amount in 1.3.2.4 but not in 1.4Hi Buddies,<br />
<br />
If we make module which perform some action on order place time in magento 1.3.2.4. and now same thing want to upgrade on 1.4. . But what we see, no payment amount, currency are shown. . (this was happening only when we take order amount from the checkout session which work on 1.3 but not on 1.4).<br />
<br />
It is just because, In magento 1.3.2.4, checkout session was flushed after placing order, but in magento 1.4 version it is flushed on order place time.<br />
<br />
Don’t be panic, just take amount, currency, or whatever data you need. . take it from the order object.<br />
<br />
$orderId = Mage::getSingleton(‘checkout/session’)->getLastOrderId();<br />
$order = Mage::getSingleton(‘sales/order’)->load($orderId);<br />
<br />
//for amount<br />
$order->getBaseGrandTotal()<br />
<br />
<br />
Cheers :)Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com0tag:blogger.com,1999:blog-3193715497690486456.post-10190995145877813352010-10-09T00:49:00.000-07:002010-10-09T02:42:32.156-07:00Dont want to merge old carts items with current quoteHi,guys<br />
Here i explain how you can prevent the cart from the old session from merging<br />
into the cart of the current session at the point when the customer login.<br />
Problem is, that a customer could basically be done shopping, logs in to their<br />
account and their cart gets filled with their old “last logged in” cart items as<br />
well as the ones they just recently picked.<br />
To prevent this from happening, here’s what I did<br />
The function loadCustomerQuote() in the observer observes the event customer_login<br />
and merges the current session quote with the last login quote object.<br />
you can see loadCustomerQuote() in :<br />
Mage_Checkout_Model_Observer.<br />
Mage_Checkout_Model_Session.<br />
<br />
<blockquote><br />
</blockquote><pre>public function loadCustomerQuote()
{
$customerQuote = Mage::getModel('sales/quote')
->setStoreId(Mage::app()->getStore()->getId())
->loadByCustomer(Mage::getSingleton('customer/session')->getCustomerId());
if ($this->getQuoteId() != $customerQuote->getId())
{
$this->_removeAllItems($customerQuote); //this will remove all items
/* if ($this->getQuoteId()) // put this on comment, </pre><pre>it will merge the old carts items with new carts
{
$customerQuote->merge($this->getQuote())
->collectTotals()
->save();
}
$this->setQuoteId($customerQuote->getId());
if ($this->_quote) {
$this->_quote->delete();
}
$this->_quote = $customerQuote;*/
}
return $this;
}
/**
* iterate through quote and remove all items
*
* @return nothing
*/
protected function _removeAllItems($quote)
{
foreach ($quote->getAllItems() as $item)
{
$item->isDeleted(true);
if ($item->getHasChildren()) foreach ($item->getChildren() as $child) $child->isDeleted(true);
}
$quote->collectTotals()->save(); </pre><pre> </pre>this is ready, go for it to crack this<br />
Gaurav Mehta<br />
<pre> </pre>Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com4tag:blogger.com,1999:blog-3193715497690486456.post-34251943767562700462010-08-27T22:32:00.000-07:002013-04-11T04:13:54.907-07:00send mail with attached file<div dir="ltr" style="text-align: left;" trbidi="on">
in magento there is no available methods for attach file. once we do it in magento by adding a following code<br />
in mage/core/model/email/template.php at the end of file.<br />
<br />
public function addAttachment(Zend_Pdf $pdf){<br />
$file = $pdf->render();<br />
$attachment = $this->getMail()->createAttachment($file);<br />
$attachment->type = 'application/pdf';<br />
$attachment->filename = 'yourfile.pdf';<br />
} <br />
<br />
but i prefer to use Zend_Mail to send mail with attached file.<br />
for this u need to do following.<br />
<br />
try{<br />
$mail = new Zend_Mail();<br />
$mail->setFrom("fromemail","fromname");<br />
$mail->addTo("toemail","toname");<br />
$mail->setSubject("subject");<br />
$mail->setBodyHtml(" body text"); // here u also use setBodyText options.<br />
<br />
// this is for to set the file format<br />
<span style="background-color: #f3f3f3; color: #444444; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 20px; text-align: justify;"> </span><span style="background-color: #f3f3f3; color: #444444; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 15px; line-height: 20px; text-align: justify;">$content = file_get_contents("$file_path");</span><br />
$at = new Zend_Mime_Part($content);<br />
<br />
$at->type = 'application/csv'; // if u have PDF then it would like -> 'application/pdf'<br />
$at->disposition = Zend_Mime::DISPOSITION_INLINE;<br />
$at->encoding = Zend_Mime::ENCODING_8BIT;<br />
$at->filename = $filename;<br />
$mail->addAttachment($at);<br />
$mail->send();<br />
<br />
}catch(Exception $e)<br />
{<br />
echo $e->getMassage();<br />
<br />
}<br />
<br />
<br />
and this is ready.. just go for it.<br />
<br />
hope this will help.</div>
Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com3tag:blogger.com,1999:blog-3193715497690486456.post-59615926551022236022010-08-27T22:14:00.000-07:002010-08-27T22:14:08.396-07:00enabled but dont want to show payment method on frontend checkoutif u wish to do like want to allowed some payment method work on backend but not in frontend. or may be like your payment method enabled <br />
but it should not appear on frontend checkout.<br />
<br />
for ex. in my case : i have one method "PAY By INVOICE". this will available in backend but not for frontend customers.<br />
<br />
to accomplish this i modified in<br />
path:- **/template/checkout/onepage/payment/methods.phtml<br />
<br />
which contain the following.<br />
<br />
<div class="payment-methods"><br />
<dl id="checkout-payment-method-load"><br />
<?php foreach ($this->getMethods() as $_method): $_code = $_method->getCode() ?><br />
<dt><br />
<?php if( sizeof($this->getMethods()) > 1 ): ?><br />
<input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $this->htmlEscape($_method->getTitle()) ?>" class="radio" onclick="payment.switchMethod('<?php echo $_code ?>')"<?php if($this->getSelectedMethodCode()==$_code): ?> checked="checked"<?php endif; ?> /><br />
<?php else: ?><br />
<span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" /></span><br />
<?php endif; ?><br />
<label for="p_method_<?php echo $_code ?>"><?php echo $_method->getTitle() ?></label><br />
</dt><br />
<?php if($html = $this->getChildHtml('payment.method.'.$_code)): ?><br />
<dd><br />
<?php echo $html; ?><br />
</dd><br />
<?php endif; ?><br />
<?php endforeach; ?><br />
</dl><br />
</div><br />
<script type="text/javascript">payment.init();</script> <br />
<br />
<br />
here i substitute the $this->getMethods() array with my local one. which will actually hold the payment methods.<br />
here i have to stop appering the "PaybyIvoicemethod". i found out using firebug that the code for this method is <br />
'paymentinvoice". <br />
so here i make one array with this little bit code.<br />
<br />
$paymentmethod = array();<br />
<br />
foreach ($this->getMethods() as $method)<br />
{<br />
if($method->getCode()!='paymentinvoice')<br />
$paymentmethod[] = $method;<br />
} <br />
<br />
as u seen, here i put condition and change orriginal array and create new one.<br />
after this you have to make one more change in original foreach loop and if statement. like following<br />
<br />
foreach ($paymentmethod as $_method): $_code = $_method->getCode() ?><br />
<dt><br />
<?php if( sizeof($paymentmethod) > 1 ): ?> <br />
....<br />
...<br />
<br />
now all things r ready. here payment method are enabled but not seen on frontend checkout..<br />
hope this will help.Anonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com0tag:blogger.com,1999:blog-3193715497690486456.post-91737539815187658892010-08-12T01:33:00.000-07:002010-08-13T21:01:15.861-07:00Magento - Reset the admin password<span class="kw1">Hi, if u getting trouble in login from admin side because of password then no worry u can reset it simply.</span><br />
<span class="kw1"> </span><br />
<span class="kw1">SELECT</span> * <span class="kw1">FROM</span> admin_user;<br />
<br />
above query should retrieve the admin user data. here find the user name name to which u want to reset password. and apply following query<br />
<br />
<br />
UPDATE admin_user SET password=CONCAT(MD5('admin123')) WHERE username='admin';<br />
<br />
u can also do this in mysql query browserAnonymoushttp://www.blogger.com/profile/13373381891364566410noreply@blogger.com0