Saturday, January 29, 2011

PrestaShop Tips - Take advantage of Paypal micro account to save Paypal transactions fees

PayPal offers support for Micropayments to merchants for US to US, GB to GB, AU to AU, and EU to EU transactions for Business and Premier accounts. This feature is offered at a special rate of 5% + $0.05 per transaction.

For example: if your Premier/Business account rate for receiving funds is 2.9% + $0.30, using PayPal's 5% + $0.05 micropayments rate would reduce the total transaction fee charged to payments received below the value of $12 (per payment). However, if you accept payments that are greater than $12, you would pay a lower processing charge by accepting the payment into the account set with the 2.9% + $0.30 rate.

For more detail on Paypal micro payment account, please visit
https://www.paypalobjects.com/IntegrationCenter/ic_micropayments.html

If you have store that have both small amount orders and big amount orders, if you can separate orders to use different account base on the order amounts, you will save Paypal transactions.

Agile Paypal - A PrestaShop Express Checkout module allows you to set two Paypal accounts(one micro and another macro) accounts so that you can get benefit from Paypal special offer of micro payment account. Bellow is the module configuration screen.



Agile Paypal has many more other features such as
Express Checkout - reduce your customer dropout rate because of unexpected error.
No customer Registration - No tedious information input(module will register customer automatically use the information from Paypal)
...and many more

For more detail, please visit http://addons-modules.com/

Saturday, January 22, 2011

PrestaShop Tips - State iso_code length problem in PrestaShop (ver 1.3.2.3 and older)

If you are using PrestaShop and ship to country with state, and the state iso code is long than 4, or has numeric character in the state iso code, you will encounter an issue. Because in PrestaShop, it only allows you input max 4 characters and alpha character A to Z or a to z only.

Problems


Not able to input iso_coe longer than 4 character
Not able to input iso_code with none-numeric character
For example, Japanese "state"(prefecture) iso_code are as following

# JP-23 Aiti (Aichi)
# JP-05 Akita
# JP-02 Aomori
# JP-38 Ehime
# JP-21 Gihu (Gifu)
# JP-10 Gunma
.......

Versions of PrestaShop have this issue
1.3.2.3 and older versions of PrestaShop have this issue.
But the latest version of 1.4 Beta 5 also have this issue at time of this post.

Solutions


There are two solutions to above problems.

Solution 1
First solution is kind of walk around.

PrestaShop is not using the state ISO CODE as a key, so it doesn't matter you input correct iso code (for state) or not. So you can use "JPAI" as ISO code of Aiti instead of JP-23. It really doesn't matter. (I think this way is much more user friendly when display on UI, even it feels a little weird). So Here is my suggestion.

# JPAI Aiti (Aichi)
# JPAK Akita
# JPAO Aomori
# JPEH Ehime
# JPGI Gihu (Gifu)
# JPGU Gunma
.....

Solution 2


Here I introduce a proper way to fix this issue. By following below instructions, you will be able to fix the issue by code, instead of using FAKE iso code as walk around.

Note: following code and line# is based on PrestaShop 1.3.2.3, it maybe a slight different for other versions.

1. Change length iso_code field in database table ps_state to 5
(You can use any database tools, such as PHPMyAdmin)

2. Change length of iso_code length validation in file /classed/State.php, line #37 (PS 1.3.2.3)

From


protected $fieldsSize = array('iso_code' => 4, 'name' => 32);


To


protected $fieldsSize = array('iso_code' => 5, 'name' => 32);



3. Change the regular express of iso_code in file /classes/Validation.php, line #258 (PS1.3.2.3)

From


static public function isStateIsoCode($isoCode)
{
return preg_match('/^[a-z]{1,4}$/ui', $isoCode);
}


To


static public function isStateIsoCode($isoCode)
{
return preg_match('/^[a-z0-9-]{1,5}$/ui', $isoCode);
}


4. Finnaly, change the length input textbox in admin/tabs/AdminStates.php file, line #107


<input type="text" size="5" maxlength="5" name="iso_code" value="'.htmlentities($this->getFieldValue($obj, 'iso_code'), ENT_COMPAT, 'UTF-8').'" style="text-transform: uppercase;" /> <sup>*</sup>
<p>'.$this->l('1 to 5 letter ISO code').' (<a href="http://simple.wikipedia.org/wiki/List_of_U.S._states" target="_blank">'.$this->l('official list here').'</a>)</p>


After finish all above changes, you should be able to input 5 characters length iso code with numeric and "-" now.

I prefer solution 2 as a developer, because it fixes the issue completely. For store owners don't know how to code at all, I suggest to use solution 1. But you can also challenge yourself, because this is not a difficult changes.

Saturday, January 15, 2011

PrestaShop Tips - Multiple language in PrestaShop and trouble shooting on translations issue

PrestaShop support multiple language environment. You can very easily make make/configure your PrestaShop store speak another languages. Here are some basic information on how to configure multiple languages at your PrestaShop store.

1. Add new language to your site.
Log in to back office - click "Tools" tab - click "Languages" sub tab - click add new language

2. Download a new language package from PrestaShop http://prestashop.com/

3. Install the new language package.
log in to you back office - click "Tools" tab - click "Translation" sub tab - look for "Import a language pack" section and upload your download file at above 2.

At this moment, you website should be able to speak a new language now.

4. Translation some other text that are not translated yet.
There must be some modules or pages that you have customized that not translated yet. In this case you need to translate them into your new languages.

log in to your back office - click "Tools" tab - click "Translation" sub tab - "Modify translations" section (on the top)

The translation are separated into following parts, (language file location is indicated in bracket)
- Front Office translations (/themes/yourstoretheme/lang/XX.php)
- Back Office translations (/translation/XX/admin.php)
- Error Message translations (/translation/XX/errors.php)
- Field Name translations (/translation/XX/fields.php)
- PDF translations (/translation/XX/pdf.php)
- Module translations (/modules/modulename/XX.php , /themes/yourstorethem/modules/modulename/XX.php)

XX is the corresponding language ISO code, for example, en - English, fr - French, es - Spanish, zh - Simplified Chinese

Some time, PrestaShop sotre ownsers encounter translation issues. You did translated at your back office and save it, but it does not reflect to your PrestaShop store.

Here are some tips on trouble shooting on translation issues.

1. First, please check that you have set proper permission for all folders and language files. Folders 755, files 644.

Check that related language files are create correctly by PrestaShop.

2. For module folder, if you have modified version under your theme folder, you also need to translate them separately.

/modules/modulename/XX.pjp
/themes/themefolder/modules/modulename/XX.php

3. For modules, text for have module indicator, for example
l s='text message' mod='modulename'

4. try to set 'display_errors' to 'on' when you perform translation at your back office. If there is any error, it will be displayed on the the top of your page. It should give you some hints and clue on what happening.

-----------------------------------------------------------------------------------
Get free useful PrestaShop modules at http://addons-modules.com/
------------------------------------------------------------------------------------

PrestaShop Tips - How to create a complete new pages

As PrestaShop store owner, some time you may want to create a complete new pages for some reason or purpose. If you just create simple PHP page, it is very easy. But if you want keep your new page compatible with PrestaShop pages, i.e. you want have the same page structure of your PrestaShop with header/footer/left column/right column/center column(main content), you will need to have some basic knowledge.

Here I explain on how to create simple page of new page which is compatible with PrestaShop page structure.

1. You need to create PHP file, which will be contain the logic of you new page.

file location: /helloworld.php

You can use following template as new page template


<?php
include(dirname(__FILE__).'/config/config.inc.php');
include(dirname(__FILE__).'/init.php');

//will be initialized bellow...
if(intval(Configuration::get('PS_REWRITING_SETTINGS')) === 1)
$rewrited_url = null;

/* CSS ans JS files calls */
$css_files = array(__PS_BASE_URI__.'css/jquery.cluetip.css' => 'all', _THEME_CSS_DIR_.'scenes.css' => 'all');

include(dirname(__FILE__).'/header.php');

$errors = array();

//==== Your new page logic begins here ==================



//==== Your new page logic ens here ==================
$smarty->assign('errors', $errors);

$smarty->display(_PS_THEME_DIR_.'choosepledge.tpl');
include(dirname(__FILE__).'/footer.php');
?>



2. Create a tpl file which will contain your UI element usually html content.

file location: /themes/yourstoretheme/hellowworld.tpl

Here is very simple one,only shows text "Hello World"


<div>
Hello World
</div>


At this moment, you should be able to run your new page now. Try to run http://yourstore-url-here/helloworld.php on your browser, you should be able see you new pages message Hello World and with all headers/footer/left/right columns.

3. Now let's do some little more, try display a product name, which product id will be passed as querystring parameter.

Adding following code to right after following line in file /helloworld.php

//==== Your new page logic begins here ==================


//load product by ID
$product = new Product(Tools::getValue('id_product'));
//assign smarty object so that you will be able to use it at your tpl file
$smarty->assign('product', $product);


4. Add following code to the tpl you created at step 2. so that it will display product name.


{l s='The product name I load is'} {$product->name}


At this moment, you should be able to run your new page with id_product parameter and the page will display the product name for you.

try to run http://yourstore-url-here/helloworld.php?id_product=11 on your browser, you should be able to see the page that display product name. (here 11 should be a product ID that really you have at your store).

Congratulations! You did it.

=========================================================
Please visit http://addons-modules.com/ for useful PrestaShop modules and some of them are free.

Agile Paypal is a Paypal Express Checkout module that does not customer registration and finish payment in just a few clicks. Get best payment module at http://addons-modules.com/ and let your customer pay the orders before they leave because of unexpected errors at your store(that you even don't know it).
=========================================================

Thursday, January 13, 2011

PrestaShop Tips - "There are no products" of category with subcategories

Problem:


As PrestaShop owner you will find a annoying message "There are no products" when you created a category with some sub-categories, but all products are only assigned to subcategories. In this case, when customer click on the parent category, the following message will be displayed, but there a lot products in its sub-categories.

There are no products.

Solution:


There are two ways to solve this problems.

This seems happening at 1.3x

Solution 1.
Set all products in the sub-categories to belong to the parent category too. One product could belong to more than one category.

Solution 2.
Make some changes make above "There are no products." only appear when the category is empty and also there is no sub-category.

Please make change at file /themes/yourtheme/category.tpl

Replace this line
{if $nb_products == 0}{l s='There are no products.'}

with following 4 lines

{if $nb_products == 0}
{if !isset($subcategories)}
{l s='There are no products.'}
{/if}

---------------------------------------------------------------------------------
Agile Paypal Express Checkout module is bug-less, stable and with many other features payment modules for PrestaShop. Please visit http://addons-modules.com/ to find out more features.

Free modules are also available at above website.

Sunday, January 9, 2011

PrestaShop Tips - How to duplicate a existing module?

The PrestaShop modular features are the one of the best features I think. Most functionality can be developed separately and independently. And further more, it is open for any contributors who would like to contribute to the community.

Sometime, store owners want to duplicate some the modules like Advertiser block module, home featured module so the they can use more than one in the application.

Here I explain in detailed instruction on how to duplicate a module with examples.

Steps to duplicate a module: (use Home Featured module as an example)
1. Copy the existing module and rename to it for new name, for example
From: homefeatured to:homefeatured1

2. Change related file name to a different ones. for example
From: homefeatured.php To: homefeatured1.php
Ffom: homefeatured.tpl To:homefeatured1.tpl

3. Change the class name of copied module class to HomeFeatured1


class HomeFeatured1 extends Module


4. Change the modules name in the class constructor to a different one, for example

$this->name = 'homefeatured1';


5. If don not want to share the parameters, you have to change the parameter name
for example, HOME_FEATURED_NBR1


Configuration::updateValue('HOME_FEATURED_NBR1', intval($nbr));


6. Change new module to use new UI(tpl) file homefeatured1.tpl file

return $this->display(__FILE__, 'homefeatured1.tpl');


7. (for Prestashop 1.4 or higher), change the module name,and tab name in configre file config.xml.

<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>blockadvertising1</name>
<displayName>Block advertising123</displayName>
<version>0.1</version>
<description>Adds a block to display an advertisement123</description>
<tab>advertising_marketing</tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
</module>




8. If the module load data from database, you need to change the part that load data.
This code usually in HookXXXXX() function. For example, HookHome, HookLeft, HookRight.

For Home Featured module are getting data from product category “Home”.
If you want load completely different data, you need use another category and for the 2nd module, load data from different category. Change the following “1” to your new category id, for example, 111.

code before change

$products = $category->getProducts(intval($params['cookie']->id_lang), 1, ($nb ? $nb : 10));


code after change

$products = $category->getProducts(intval($params['cookie']->id_lang), 1111, ($nb ? $nb : 10));



-----------------------------------------------------
Looking for stable/bug-less and more features Paypal payment module for your PrestaShop? I recommend Agile Paypal Express Checkout.




Agile Paypal is a Paypal Express Checkout module for PrestaShop. It is very stable and bug-less PrestaShop Paypal module. Among many other features, Express Checkout that allow customer checkout without sign up/log in. This module will redirect customer to Paypal payment page in less than 3 clicks. See more detail here http://addons-modules.com/
-----------------------------------------------------

Monday, January 3, 2011

PrestaShop Tips - why upload_max_filesize not changing

At PrestaShop back office adminCatalog page, you are able to upload product file for down loadable products. But most store owners are frustrated with default 2M file size limit. Because they don't how to change upload_max_filesize so that they can upload larger files.

I was one of those frustrated, but finally I solved my problem so I post my experience to share with others.

I was using WAMP windows version.

1. In configuration file /config/config.inc.php, there is following line try to change the parameter of upload_max_filesize

@ini_set('upload_max_filesize', '100M');
@ini_set('default_charset', 'utf-8');

But these two line usually seem not working, because not all PHP parameters are changeable by ini_set() command. Please see below for a list of parameters that you can change by ini_set().

http://www.php.net/manual/en/ini.list.php

2. At AdminCatalog.php page, there are following default definitions. It seems that you are able to upload maxFileSize is 10000000 (10M). But you still can not upload more than 2M size file.

protected $maxImageSize = 2000000;
protected $maxFileSize = 10000000;

3. I found this parameter defined in following php.ini file.
C:\wamp\bin\php\php5.3.0\

I changed this from default 2M to 10M or more, it still doesn't work.

4. Some people say that you can run phpinfo() in php script to see what php.ini is effect. I tried, in my environment it pointed c:\windows\php.ini, but underthis folder php.ini does not exists at all.

5.Finally,I found another php.ini in following folder
C:\wamp\bin\apache\Apache2.2.11\bin

I changed the parameter in php.ini under this folder, finally it worked for me.

Conclusion:
A. There are many places that set parameter upload_max_filesize, but only one place php.ini will work for you. You need to find out all php.ini

B. Every time you make changes on php.ini file, you need to restart WAMP service to make it effect.

C. If your site is hosted by ISP, I suggest you contact your ISP.


-----------------------------------------------------
Looking for stable/bug-less and more features Paypal payment module for your PrestaShop? I recommend Agile Paypal Express Checkout.




Agile Paypal is a Paypal Express Checkout module for PrestaShop. It is very stable and bug-less PrestaShop Paypal module. Among many other features, Express Checkout that allow customer checkout without sign up/log in. This module will redirect customer to Paypal payment page in less than 3 clicks. See more detail here http://addons-modules.com/