Archive for the 'php' Category

15
May

Fix Magento Connect Manager 404 error by resetting the folder permission

If you encounter 404 error when you connect to Magento Connnect Manager (System-> Magento Connect Manager), it is probably due to your folder permission not set up correctly.

Fortunately, there is a quick fix for this.

Download the magento clean up tool (a php file) and upload to your store root folder.

Once done, browse to the clean up tool (http://www.yourstore.com/magento-cleanup.php) and you will see a list of messages that it has reset the folder permission.

VN:F [1.9.7_1111]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.7_1111]
Rating: 0 (from 0 votes)
15
May

Install chinese locale for Magento Admin 1.5

Unfortunately, the default Magento does not comes with all the languages installed. Changing the language dropdown at the bottom of the page will not change the interface.

Here’s how to install chinese language for the admin

1. go to magento connect and install the below 2.0 extension key


http://connect20.magentocommerce.com/community/Locale_Mage_community_zh_CN

2. Once installed, check your app\locale and you will see a lot of csv files in the folder. Those files are created by the extension… in the wrong folder!

3. Create a folder ‘zh_CN‘ in app\locale and move all the csv files in app\locale to app\locale\zh_CN

4. Once done, go back to admin page and flush your cache (system -> cache management -> flush magento cache)

5. Change the language to chinese (china) and you should be able to view it in chinese (hopefully)

VN:F [1.9.7_1111]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.7_1111]
Rating: +1 (from 1 vote)
15
May

Fix google anlaytics in magento custom template

If you have turned on your google analytics in admin console and you are using custom design template but the google analytics is not showing up in your html codes, look at the below steps to check if the codes are in your custom design are in placed.

1. check page.xml in app\design\frontend\default\[yourtemplate]\layout and verify if the following line is in place.

\\app\design\frontend\default\[yourtemplate]\layout\page.xml

2. open *.phtml in app\design\frontend\default\magikjewellery\template\page and verify if the following line is after the tag

\\app\design\frontend\default\[yourtemplate]\template\page\1column.phtml
\\app\design\frontend\default\[yourtemplate]\template\page\1columnhome.phtml
\\app\design\frontend\default\[yourtemplate]\template\page\2columns-left.phtml
\\app\design\frontend\default\[yourtemplate]\template\page\2columns-right.phtml
\\app\design\frontend\default\[yourtemplate]\template\page\print.phtml

...

<!--?php echo $this--->getChildHtml('after_body_start') ?&gt;
...

3. clear your cache by going to admin -> system -> cache management and flush magento cache

4. open your home page, right click on it and select view source and check if the following codes are generated.

<!-- BEGIN GOOGLE ANALYTICS CODE -->
<script type="text/javascript">
//<![CDATA[
    (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
    })();

    var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-1234567-7']);
_gaq.push(['_trackPageview']);

//]]>
</script>
<!-- END GOOGLE ANALYTICS CODE -->
VN:F [1.9.7_1111]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.7_1111]
Rating: 0 (from 0 votes)
27
Feb

symfony conditional validation

Below are the snippets on how to implement a conditional validation in the form. i.e. validate field A if field B is true

As discussed in this tutorial (though it is for symfony 1.2, it will works in 1.4), the key thing is to set a post validator to validate values after the initial validation.

Continue reading ‘symfony conditional validation’

VN:F [1.9.7_1111]
Rating: 9.5/10 (2 votes cast)
VN:F [1.9.7_1111]
Rating: 0 (from 0 votes)
09
Jan

symfony backend: displaying thumbnail or photo in listing

if you are using the admin generator to generate your backend application and want to show thumbnail or photo in your listing, you can try the following steps.

Here’s an example of how it will looks like when the thumbnail is showing on the listing page.

Before you add it in, you need to check the variable name of the row that the admin generator uses.

To check the variable name, go to the cache folder for the module and open the _list.php file with a notepad.
Take note of the row

\\cache\backend\dev\modules\autoContestphoto\templates\_list.php
...
        <?php foreach ($pager->getResults() as $i => $contest_photo): $odd = fmod(++$i, 2) ? 'odd' : 'even' ?>
          <tr class="sf_admin_row <?php echo $odd ?>">
            <?php include_partial('contestphoto/list_td_batch_actions', array('contest_photo' => $contest_photo, 'helper' => $helper)) ?>
            <?php include_partial('contestphoto/list_td_tabular', array('contest_photo' => $contest_photo)) ?>
            <?php include_partial('contestphoto/list_td_actions', array('contest_photo' => $contest_photo, 'helper' => $helper)) ?>
          </tr>
        <?php endforeach; ?>
...

In my case, the variable name for the row is $contest_photo

Next, create a partial call _thumbnail.php in the template folder of the module.
In this partial, echo the path of the thumbnail or the photo with a img html tag

\\apps\backend\modules\contestphoto\templates\_thumbnail.php
<img src="<?php echo $contest_photo->getThumbnailPath() ?>"/>

Then, edit the generator file to include the _thumbnail column for your list

\\apps\backend\modules\contest\config\generator.yml

...

      list:
        title: Contest Photo Management
        display: [=title, contest, category, user, title, isDeleted, _thumbnail]
        sort: [created_at, desc]
        max_per_page: 50

...

Clear your cache and see if the thumbnail loads.

VN:F [1.9.7_1111]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.7_1111]
Rating: 0 (from 0 votes)



Search Website

www.lingeriesg.com

www.lingeriesg.com

Sponsored Ads

Sponsored Links

www.asiadolly.com

www.asiadolly.com

About Me

Me

Hello, Im Benny Chong. This blog is a proof that I have too much spare time to burn. 

I will be writing topics mainly on web design, application development, photography and other rubbish. Cheers