Saturday, October 2, 2010

PrestaShop Tips - How to change address displaying format (front store)

--------------------------------------------------------------
Note: (edited on August 27, 2011)
If you are using PrestaShop 1.4x and above, you are able to change the format at your back office. Back Office - Shipping - Countries - edit country and change Address Layout
--------------------------------------------------------------

At PrestaShop, the addresses are default displayed in Europe address format. They look weird for some other country's addresses for example in USA or Canada. Here I explain on how to change the address display format for USA/Canada. I separate them into front store and back office, so it will be in two posts.

For changing address displaying format in back office, please click here

Here is my first post on how to change PrstaShop address displaying format at front store. For your reference, I attached comparison screen of files before/after change.


1. ./themes/yourTheme/addresses.tpl
Replace line 25,26 with following two lines


<li class="address_city">{$address.city} {if isset($address.state)} {$address.state}{/if} {$address.postcode} </li>
<li class="address_country">{$address.country}</li>



2. ./themes/yourTheme/order-address.tpl
Replace line 6 with following line

addresses[{$address.id_address|intval}] = new Array('{$address.company|addslashes}', '{$address.firstname|addslashes}', '{$address.lastname|addslashes}', '{$address.address1|addslashes}', '{$address.address2|addslashes}', '{$address.postcode|addslashes}', '{$address.city|addslashes}', '{$address.country|addslashes}','{$address.state|addslashes}');



3. ./themes/yourTheme/order-detail.tpl
Replace line 53,54 and with following lines

<li class="address_city">{$address_invoice->city|escape:'htmlall':'UTF-8'} {if $invoiceState} {$invoiceState->name|escape:'htmlall':'UTF-8'}{/if} {$address_invoice->postcode|escape:'htmlall':'UTF-8'}</li>
<li class="address_country">{$address_invoice->country|escape:'htmlall':'UTF-8'}</li>

Replace lin 64,65 with following lines

<li class="address_city">{$address_delivery->city|escape:'htmlall':'UTF-8'} {if $deliveryState} {$deliveryState->name|escape:'htmlall':'UTF-8'}{/if} {$address_delivery->postcode|escape:'htmlall':'UTF-8'} </li>
<li class="address_country">{$address_delivery->country|escape:'htmlall':'UTF-8'}</li>



4. ./themes/yourTheme/shopping-cart.tpl
Replace line 214,215 with following lines

<li class="address_city">{$delivery->city|escape:'htmlall':'UTF-8'} {if $delivery_state}{$delivery_state|escape:'htmlall':'UTF-8'}{/if} {$delivery->postcode|escape:'htmlall':'UTF-8'}</li>
<li class="address_country">{$delivery->country|escape:'htmlall':'UTF-8'} </li>

Replace line 225,226 with following lines

<li class="address_city">{$invoice->city|escape:'htmlall':'UTF-8'} {if $invoice_state}{$invoice_state|escape:'htmlall':'UTF-8'}{/if} {$invoice->postcode|escape:'htmlall':'UTF-8'}</li>
<li class="address_country">{$invoice->country|escape:'htmlall':'UTF-8'} </li>



5. ./themes/yourTheme/js/order-address.js
Replace line 47,48,49 with following lines

$('ul#address_' + addressType + ' li.address_name').html(addresses[idAddress][1] + ' ' + addresses[idAddress][2]);
$('ul#address_' + addressType + ' li.address_address1').html(addresses[idAddress][3] +',');
$('ul#address_' + addressType + ' li.address_address2').html(addresses[idAddress][4] +',');

Replace line 54,55 with following lines

$('ul#address_' + addressType + ' li.address_city').html(addresses[idAddress][6] + ' , ' + addresses[idAddress][8] +', '+addresses[idAddress][5]);
$('ul#address_' + addressType + ' li.address_country').html(addresses[idAddress][7] +'.');

Sunday, September 26, 2010

PrestaShop Information - Prestashop templates and themes

What is PrestaShop template/themes?


PrestaShop theme is a pre-made template design for PrestaShop powered online store. Premium PrestaShop templates designed by experienced ecommerce template designers are by all means the best way to improve your web shop with professional look and appeal. You know - clothes count for first impressions. Same applies to your PrestaShop powered web store. Have your web eCommerce project favorably differ from your competitors with clean top-notch PrestaShop theme.



What is PrestaShop?


PrestaShop is a full-featured, cross-platform open-source eCommerce shopping cart solution for the Web 2.0 era. PrestaShop is free, is customizable, stable, and "weighs" only 2.2MB for a quick and easy installation. Combined with premium PrestaShop template it's by far the best eCommerce solution for small and medium online stores.



Buy Prestashop templates and themes at All Budget Shop


All Budget Shop presents PrestaShop themes from professional designers. PrestaShop shopping cart application is rapidly taking over eCommerce community in terms of popularity due to its clean modern architecture which makes it extremely lightweight and fast to use.
Somehow most of the open-source eCommerce solutions lack professional graphic design templates. That's where Template Monster steps in and contributes top quality PrestaShop templates to fit the need of store owners for pro designs

PrestaShop Tips - How to Create Order From Cart (Recover a Missed Order)

Free PrestaShop Modules/Addons/Modification
You can get this free modification here

The Problem


Your customer has paid but can't finalize an order? Your payment module sometimes does not work and your orders are lost?

Have you ever got in trouble that your customer placed an order, successfully paid the order, but the order does not show up on your back office? Yes, I have had more than one times got this problem. In that case, what you can do is manually create the order again or create the records via PhpMyAdmin.

If you are uing PrestaShop 1.3 or lower, then you can not find a good solution for above situations.

Solution


Here I modified the AdminCarts.php page so that you can create an order from shopping cart very easily by just one click.



Above screen shot of Cart Detail page with extended Order Recovery function.

Features


  • You can input Payment method, amount paid and transaction # for the order to generate.

  • You can create order for existing shopping cart by just one click.

  • If the cart already has an order generated, then this UI will be hidden to avoid duplicated order generated from same cart.

  • This UI only appears when customer info is available in the cart. So that you will not generate dummy orders.


  • Now a free version of addon is available for download.

    Saturday, September 25, 2010

    PrestaShop Tips - Payment recieved via Paypal, but order not showing up

    The Problem:
    I have a PrestaShop 1.3 website, it was working fine, but suddenly the following problem appeared.

    1. User can place an order without any error.
    2. The payment was also processed without any problem. I was using Paypal Module v1.6
    3. But there is no order record was created in my database

    There are multiple scenarios could cause the same problem, here I introduce a way yo help you identify your problem.

    Important
    PayPal has changed their “notify_url” behavior sometime recently. You must enable IPN at your Paypal account to get your Paypal module at PrestaShop work. If you disable IPN in your PayPal account no IPNs will be sent regardless of whether you pass a notify_url value.


    How to identify your problem
    Before I fixed the problem, first I tried to understand in what timing the order record is created. The order record is not created until the payment process is finished at Paypal and Paypal server send back payment information to following page:

    http://YouPrestaShopSite/modules/paypal/validation.php

    Based on the payment status from Paypal, the order record will be created and linked to the cart record. In order to identity the problem, you can add following line on the top of above file (at position of line 4) and then create an test order.


    mail("YouEmailAddress","Response From Paypal","Data from Paypal".print_r($_POST,true));


    Result
    1. If you can receive email and response data from Paypal, the problem is reside your website.
    2. If you do not receive email, it means Paypal server is not able to reach your server.

    In my case, the problem is scenario 2. I do not receive the email.
    I did following two things fixed my problem.
    1. At Paypal side, I changed my IPN setting
    Profile | Selling Preferences | Instant Payment Notification Preferences
    2. At PrestaShop back office, I uninstall the Paypal module v1.6 and re-install, re-config the module
    Modules | Paypal Module v1.6

    More information
    See my another post on how to add "Create Order" from cart to recover your missed orders. http://alvinjiang.blogspot.com/2010/09/prestashop-tips-how-to-create-order.html

    The post below has more information which help me a lot fix my problem.
    http://www.presto-changeo.com/content/10-fixing-paypal-problems

    Friday, September 24, 2010

    PrestaShop Information - New features for PrestaShop v1.4

    PrestaShop v1.4 Alpha

    Several new features have been incorporated into PrestaShop v.1.4, including:

    * Improved modules page in the Back-Office
    * Ability to translate the e-mails templates directly from the Back-Office
    * Customer service integrated into PrestaShop
    * Updated the text editing tool (TinyMCE)

    * Instant Search included
    * Editorial module enhanced
    * Ability to define additional shipping costs per product
    * Module displaying the estimated date of delivery
    * Ability to configure each carrier by price or by weight


    You can download PrestaShop v1.4 Alpha at Download PrestaShop

    PrestaShop Information - New payment module eWay


    The new eWay payment module for PrestaShop
    PrestaShop Addons publish this week a new payment module, eWAY.

    The EWAY Hosted Payment solution allows your customers to be redirected to a secure eWAY payment page via HTTP FORM POST. Customers will enter their credit card details and finalize their payment before being returned to your website.

    By PrestaShop: The module eWAY UK for PrestaShop has been developed by the PrestaShop Team, guaranteeing a full compatibility with PrestaShop e-commerce software.

    You can download the new module, please visit PrestaShop Addons

    About eWay

    eWAY is a global payment gateway company allowing businesses from Australia, New Zealand, United Kingdom and Europe to process credit card and debit cards directly from their online store on their website.

    eWAY provides a wealth of features and reporting to assist you to manage your online revenue, via the Business Centre. The Business Centre supports your eCommerce business by providing market leading transaction reports for all your online payments, as well as providing online charting to demonstrate your online payment trends. Processing refunds, manual payments, recharging a customer's credit card or resending an email receipt to a customer is easy with the Business Centre's Transaction Reports.

    PrestaShop Tips - How to reset or recovery back office admin password

    Have you ever forgot your back office admin password of PrestaShop website? The system provides "forgot password" function to help you reset your password and send email the new temporary password.

    But if the email function (SMTP) is not set correct, for example you installed PrestaShop at your home machine for development purpose, you will never receive the email. Here are two solutions to help you regain your access to your back office.

    Solutions 1: Modify DB using _COOKIE_KEY_ and MD5


    0. Please make sure you have access to the database.
    1. Please look up the _COOKIE_KEY_ from your configuration file /config/setting.inc.php
    2. RUN following SQL statement to your PrestaShop database to update your employee record.


    UPDATE ps_employee SET passwd = md5('_COOKIE_KEY_YOUNEWPASSWORD') WHERE email = 'YOUEMAILADDRESS';

    Note:
    x. Please replace _COOKIE_KEY_ with the value you looked up from setting.inc at 1.
    x. Please replace YOUNEWPASSWORD with you new password.
    x. Please replace YOUEMAILADDRESS with you real email address in your PrestaShop database table
    x. Please replace ps_employee with your real table name if you changed prefix at installation.

    Click below image to see more detailed instructions on how to create SQL statement.


    After running this SQL statement against your database via MyPhpAdmin. You should be able to login with the new password.

    Solution 2: Bypass authentication


    This solution works if you don't have database access. But in order to do so, you must have permission access and modify the source code of PrestaShop website. It doesn't matter via FTP tools or website control panel.

    How to do it:
    1. Connect to PrestaShop website via FTP or control panel file manager.
    2. Download following file from your website
    /YourPrestaShopRoot/admin/login.php

    Note:
    - Usually the admin folder is changed for security reason, in that case, please replace it with your correct folder name for admin.
    - If you have not changed your admin folder, please changed it immediately!

    3. Backup login.php file before you modify it.(make a copy)
    4. Change following line 52 (line number may different for different version)


    $employee = $employee->getByemail($email, $passwd);


    After change


    $employee = $employee->getByemail($email, NULL);

    5. upload the modified login.php file to your website and replace existing one.
    6. Now you can login to you back office with any password password that meets password criteria! (By default it requires at least 6 characters).
    7. After you login, go to change your password at "Employee" tab
    8. Restore the login.php file with one you backed up at above 3.

    Cautions!
    The methods introduced below are to by-pass authentication and gain access to your website. If you any other way to recovery your password, please do so. Here are some other ways to do.
    1. Use forgot password function of the system.
    2. Ask another admin to reset password for you.
    3. Above Solution 1 in this post