Tips & Tricks - November 26, 2009 - 3 Comments
Prestashop : quote module (devis)
The quote feature  is  an implementation of a shopping cart within prestashop framework, without the price : we have designed this feature for specific groups, for which we deactivate the price display on the shop.
- Deactivating price display for specific user group (below : group 2) is a long task that involves 2 different steps
- in init.php : set the smarty variable around line 116
-
if($tmpCust->isMemberOfGroup(2)) $priceDisplayConfig = 3;
And around line 155
-
‘priceDisplay’ => $priceDisplayConfig
- use the smarty $priceDisplay variable in the templates to hide prices and change the “cart’ (panier in french) to “quote” (devis), example from homefeature.tpl
-
{if $priceDisplay<3}{l s=‘Add to cart’ mod=‘homefeatured’}{else} Ajouter au devis {/if}
-
- in init.php : set the smarty variable around line 116
- Quote / Devis module and status :
- Download and install the “devis” module Module Devis pour prestashop (290)
- create the mails/devis.html and mail/devis.txt and change texts according to your business
- create the order status “devis en cours” in BackOffice >> Orders >> statuses, check the created id (12 here) and add the following line to config.inc.php :
- You can optionnally deactivate the order confirmation email in classes/PaymentModule.php, line 288-290, replace the send email to customer test by adding a new condition :
-
// Send an e-mail to customer
-
if ($id_order_state != _PS_OS_ERROR_ AND $id_order_state != _PS_OS_CANCELED_ AND $customer->id
-
AND $id_order_state != _PS_OS_DEVIS_EN_COURS)
-
Tips & Tricks - November 9, 2009 - No Comment
How I installed sub labels on gmail
while gmail is certainly one of the most professionnal email readers, I still like to sort messages in folders and sub folders the way I used to do in old outlook clients. Even though google tries to promote its wonderful search capabilities, argumenting they remove the need for hierarchical labelling, I can’t get it out of my mind, and I ‘m not the only one. As of today, is takes a few minutes to configure your PC / chrome navigator to process sub folders.
- download the sub folders script from the adresse below and save it  to chrome’s directory :
http://arendvr.com/folders4gmail/
Local Settings\Application Data\Google\Chrome\User Data\Default\User Scripts - enable user script on your chrome application by using the –enable-user-scripts command line tag,a s sexplained here
http://arendvr.com/folders4gmail/
E commerce, Tips & Tricks - October 29, 2009 - No Comment
Magento : how to learn from free templates
The power of Magento is great but it requires long days of learning and suffering to get through relative simple features, such as the now common front page slide banner. I had a quick look at magento free templates on google and was conquered by Magento ’s classic theme, the kind of  stuff that’s really given free of charge when I would have paid for it. It actually comes with an interesting development of Magento’s block systems, and demonstrates how to add a custom block between navigation and content : the prototype glider that scrolls images is defined a cms static block, which is then called in the home page CMS  custom xml definition, with a reference to the slider block that’s positionned in phtml files and declared in the xml layouts as a core/text_list type . Impressive stuff : that’s pure  magento design and illustrates how versatile the system is.
Links : 25 free templates for Magento
Tips & Tricks - October 19, 2009 - No Comment
Use Zend_Form to create SQL table
A quick code snippet that uses a Zend form (in the case below, with subforms) to generate a SQL table create statement. Useful for scaffolding : create your form with Zend Form Elements then the SQL table automatically.
-
<textarea rows="50" cols="80">
-
create table yrbeaute (`id` int(10) NOT NULL AUTO_INCREMENT,<?
-
foreach($this->form as $k=>$subform)
-
{
-
foreach($subform as $k=>$element)
-
{
-
if ($element->getType()=="Zend_Form_Element_Select") $type="varchar(50)";
-
if ($element->getType()=="Zend_Form_Element_Radio") $type="varchar(50)";
-
if ($element->getType()=="Zend_Form_Element_Text") $type="varchar(255)";
-
if ($element->getType()=="Zend_Form_Element_Textarea") $type="text";
-
if ($element->getType()=="Zend_Form_Element_MultiCheckbox") $type="varchar(255)";
-
?>
-
<?=$element->getName() ?> <?=$type?>,
-
<?
-
} else
-
foreach($element as $k=>$elem )
-
{
-
?><?=$elem->getName() ?> varchar(50),
-
<?
-
}
-
-
}}
-
?> step int(5), `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
Image, Tips & Tricks - September 1, 2009 - No Comment
Prestashop, how to transfer cart to order manually
Prestashop has a nice feature that allows administrator to view a customer’s shopping cart : while the shopping cart is relatively easy to use for novices, the number of steps involved in completing the transaction can discourage some users, who might be tempted to ask you for help. What can you do apart from helpinog the guy to fill in forms ? The technique below illustrates how to simulate a payment using the Cheque payment type, via the creation of a hard coded validation page. Be careul, this is for good PHP coders only as you have to interfere with low level classes from Prestashop.
- go to Modules / cheque / validation.php and duplicate the file to validationManual.php
- Paste the code blow under the includes to instanciante the shopping cart using the ID of the shopping cart you want to transfer to an order, here we have the id 9304
- change the currency id to reflect the currency you want to use, you’ll find the currency id in the currency module of the prestashop administration interface
- call the module/cheque/validationManual.php from the browser, s if it was called after a valid paymen
- Go to Prestashop administration interface to check that the order has been created
- you might be wise to try to place a new order for testing that the manual process has not disturbed prestashop’s database integrity
// 1 . get currency ID $currency = new Currency(1); // 2 get cart id $cart = new Cart( 9304); $total = floatval(number_format($cart->getOrderTotal(true, 3), 2, '.', '')); $mailVars =Â Â Â array( '{cheque_name}' => Configuration::get('CHEQUE_NAME'), '{cheque_address}' => Configuration::get('CHEQUE_ADDRESS'), '{cheque_address_html}' => nl2br(Configuration::get('CHEQUE_ADDRESS'))); $cm = new Cheque(); $cm->validateOrder($cart->id, _PS_OS_CHEQUE_, $total, $cm->displayName, NULL, $mailVars, $currency->id); $order = new Order($cm->currentOrder);
Tips & Tricks - July 14, 2009 - No Comment
Make site maps from HTML lists with slickmaps
It’s amazing what one can do these days with jsut HTML and CSS. Slick map css builds a visually attractive sitemap that could also be used to build organigrams, straight from a single line of ul / li HTML tags. It formats ul tags up to three levels of page navigation and additional utility links – and can easily be customized to meet your own individual needs, branding, or style preferences. Designed by Matt Everson, Minnesota.
Tips & Tricks - June 26, 2009 - No Comment
Tip : convert mac fonts to TTF
Handling mac to ttf conversino is a simple task but necessary when working with designers. CrossFont v5.4, developped by actute systesm INC in ILLINOIS (USA) does a nice job converting any mac format even when it’s been transferred to a PC via zip files.
Tips & Tricks, Web Components - May 27, 2009 - 6 Comments
Magento one page checkout : display shopping cart details in sidebar
There are a lot of discussions going on about Magento’s one page checkout procedure : it is supposed to enhance customer payment experience by probviding ajax based single page order progress. But there are alos some discussions in the forum on how to enhance this process which is quite unusual and might discourage some customers. In a previous post I reviewed the code that produces sidebar shopping cart in default pages with right margin. The solution below explains how to add a full shopping cart display for the customer’s that trying to complete an order.
Hosted applications, Tips & Tricks, Web Components - March 11, 2009 - 9 Comments
Magento custom attributes display on product page
The flexibility created by the attribute feature in Magento allows limitless possibilities : vairous product types can be created and each of them can go with specific attributes, meaning specific form fields for the admin, that are inserted in the product view (template/product/view.phtml) for public display. The functions availble for each user defined attributes are very simple to guess : they are dynamically created for each attribute create using , as explained in the Pratthost developer zone blog…
Read the rest of this entry »
Tips & Tricks - February 10, 2009 - No Comment
Magento simple ssh install
The magento wiki has a good article that details how to install Magento with the help of PEAR downloader. We don’t need that, just want to install magento via ssh in a few commands, here is the detail. Before you install, make sure you check requirements, especially innoDB option for mysql.
Â
- go to your root folder and download magento :
 wget http://www.magentocommerce.com/downloads/assets/1.2.1/magento-1.2.1.tar.gz - unzip tar and delete it :
 tar xvzf magento-1.2.1.tar.gzÂ
rm magento-1.2.1.tar.gz
 - copy files back to your root folder, including htaccess, then remove the magento dir
 mv magento/* . Âmv magento/.ht* .rmdir magento/Â
- chmod / chuser files in order to let apache do its job
chown magento:users * -R
 for i in $( find . -type d ); do chmod 755 $i; done Â for i in $( find . -type f ); do chmod 644 $i; done
Not that you mightr have to specify your own permissions in the last command. If you’ve got there, That’s it, you’re ready to run the installer, GOOD LUCK. Core upgrades can be done via the Magento Downloader.





