Skip to content

Instantly share code, notes, and snippets.

@wfpaisa
Last active June 8, 2018 21:53
Show Gist options
  • Save wfpaisa/c8421bd4bfd4ae04d22f98c024caa01c to your computer and use it in GitHub Desktop.
Save wfpaisa/c8421bd4bfd4ae04d22f98c024caa01c to your computer and use it in GitHub Desktop.
Prestashop migration 1.6 to 1.7

Prestashop migration 1.6 to 1.7

Prestashop guide http://doc.prestashop.com/display/PS17/Migrating+a+module+from+1.6+to+1.7

New helpers

https://developers.prestashop.com/themes/smarty/helpers.html

Links

https://webkul.com/blog/links-creation-on-tpl-files-in-prestashop-1-7-using-url/comment-page-1/#comment-11209

File: classes/link.php -> function getUrlSmarty($params).

1.6 : {$link->getModuleLink()}
1.7 : {url entity='module' name='myModule' controller='myController' params = ['paramKey1' => $paramValue1, 'paramKey2' => $paramValue2]}
Example : {url entity='module' name='marketplace' controller='productupdate' params=['edited' => 1, 'id' => $id]}

1.6 : {$link->getPageLink()}
1.7 : { url entity='myPageName' params = ['paramKey1' => $paramValue1, 'paramKey2' => $paramValue2]}
Example : { url entity='my-account' params=['edited' => 1, 'id' => $id]}

1.6 : {$link->getCategoryLink()}
1.7 : {url entity='category' id=$id_category id_lang=$id_lang}
Example : {url entity='category' id=3 id_lang=2}

1.6 : {$link->getCmsLink()}
1.7 : {url entity='cms' id=$id_cms id_lang=$id_lang}
Example : {url entity='cms' id=3 id_lang=2}

1.6 : {$link->getCatImageLink()}
1.7 : {url entity='categoryImage' id=$id_category name='imageType'}
Example : {url entity='categoryImage' id=3 name='home-default'}

1.6 : {$link->getProductLink(13)|escape:'html':'UTF-8'}
1.7 : {url entity=product id=13 ipa=1} // ipa(id_product_attribute)
More info: https://github.com/PrestaShop/PrestaShop/pull/7740/commits/0addfc498440be80d946a2fcb3926dc65030c1cc

Add files

Priority is the order

// CSS
1.6: $this->context->controller->addCSS(($this->_path).'blockwishlist.css', 'all');
1.7: $this->context->controller->registerStylesheet('modules-blockwishlist', 'modules/'.$this->name.'/views/css/blockwishlist.css', ['media' => 'all', 'priority' => 150]);

//Javascript
1.6: $this->context->controller->addJS(($this->_path).'js/ajax-wishlist.js');
1.7: $this->context->controller->registerJavascript('modules-blockwishlist', 'modules/'.$this->name.'/views/js/ajax-wishlist.js', ['position' => 'bottom', 'priority' => 150]);

Templates

1.6: $this->setTemplate('mywishlist.tpl');
1.7: $this->setTemplate('module:blockwishlist/views/templates/front/mywishlist.tpl');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment