PrestaShop Module Development – Where to start?

Developing a PrestaShop plugin or theme is not an easy task. There fore you need to find the right resources to start learning development of a custom module.

Where to find video tutorials: https://beautifulweb.pl/prestashop-module-development-where-to-start/

PrestaShop Module Development Tutorial

Developing a custom module may bring a lot of cool features to your PrestaShop site. Lest start here:
https://prestapros.com/blog/jak-napisac-modul-prestashop
The code in above article present a bare minimum for a plugin to work in PrestaShop environment.
There are module templet generators that can help us to set up proper folder hierarchy. Lets have a look at module generator:

PrestaShop module skeleton generator

https://validator.prestashop.com/generator

Above online generator allow us to create a quick template for our plugin including database setup, hook declaration and many more.

PrestaShop Module development documentation:

To be able to understand the code given by the generator we need to work closely with a documentation https://devdocs.prestashop.com/1.7/modules/

It is also possible to learn more about PrestaShop from online tutorials. Unfortunately there are not many resources available online. Here is few tutorials that we where able to find for PrestaShop 1.7.:

PrestaShop Smarty Global Variables and Twig conversion

Smarty Doc. | Twig Doc. | PrestaShop Theme Development Doc 1. && Doc 2| PrestaShop Module Development Doc.

PrestaShop uses .twig template, but many themes from the themes repository such as themeforest uses php smarty engine to power their view pages. (.tpl). There are some global SMARTY variables available by default in PrestaShop. Here is a list of them:

General info about your online store

{$shop.name} Store name
{$shop.email} Store Email
{$shop.logo} Store logo
{$shop.favicon} Store icon (map, title of the browser window, etc.)
{$shop.address.address1} Store address 1
{$shop.address.address2} Store address 2
{$shop.address.postcode} Store Zip Code
{$shop.address.city} Store City
{$shop.address.state} Store State (Province)
{$shop.address.country} Store Country
{$shop.phone} Store Telephone
{$shop.fax} Store Fax

Language

{$language.name} Name of the language in use (example: English) 
{$language.iso_code} ISO code of the language in use (it for Italian, fr for French, etc.)
{$language.language_code} Code of the language in use (it for Italian, en-us for American English, etc.)
{$language.is_rtl} (1 when language is written from right to left; 0 if from left to right)
{$language.id} ID value of the language in use

Currency

{$currency.name} Name of the currency in use (Euro, American Dollar, etc.)
{$currency.iso_code} Currency ISO code of the currency in use (Eur, USD, etc.)
{$currency.sign} Symbol of the currency in use (€, $, etc.)
{$currency.iso_code_num} ISO code number of the currency in use (978 for Euro, 840 for American Dollar, etc.)

Pages and elements of the e-commerce site

{$urls.base_url} Store web address (example: https://www.themebooster.com)
{$urls.current_url} Current web address (url), the page we are viewing
{$urls.shop_domain_url} Store domain
{$urls.img_ps_url} Image root directory url
{$urls.img_cat_url} Url of the categories images directory
{$urls.img_lang_url} Url of the languages images directory
{$urls.img_prod_url} Url of the products images directory
{$urls.img_manu_url} Url of manufacturers images directory
{$urls.img_sup_url} Url of providers images directory
{$urls.img_ship_url} Url of carriers images directory
{$urls.img_store_url} Url of physical store images directory
{$urls.img_url} Url of theme images directory
{$urls.css_url} Url of css files directory used by the theme
{$urls.js_url} Url of javascript files directory used by the theme
{$urls.pic_url} Url of file uploaded directory
{$page.page_name} Page Name (file template)
{$page.meta.title} Page Title (SEO)
{$page.meta.description} Tag description content (SEO)
{$page.meta.keywords} Tag keywords content (SEO)
{$page.meta.robots} Rule for search engines: blocks or not the page indexing (SEO)
{$page.canonical} Indicates the canonical (main) URL to avoid duplication of contents (SEO)
{$urls.pages.address} Url of the "My Address" section (registered user)
{$urls.pages.addresses} Url of the "My addresses" section (registered user)
{$urls.pages.authentication} Url of the authentication page
{$urls.pages.cart} Url of cart page (order summary)
{$urls.pages.category} Url of the category
{$urls.pages.cms} Url of the page (type CMS)
{$urls.pages.contact} Url of the contact page
{$urls.pages.discount} Url of the discount voucher page
{$urls.pages.guest_tracking} Tracking url for unregistered clients
{$urls.pages.history} Url of the "Order History" page (registered user)
{$urls.pages.identity} Url of the "Personal data" page (registered user)
{$urls.pages.index} Home page url
{$urls.pages.my_account} Url of "My Account" page (registered user)
{$urls.pages.order_confirmation} Url of the "Order Confirmation" page
{$urls.pages.order_follow} Url in the "Order Tracking" (registered user)
{$urls.pages.order} Url of the "Order" page
{$urls.pages.order_return} Url of the "Order Return" page
{$urls.pages.order_slip} Url of the "Order Slip" page
{$urls.pages.pagenotfound} Url of the "404 - Page not found"
{$urls.pages.password} Url of "Recover Password" page
{$urls.pages.pdf_invoice} Url of Pdf invoice
{$urls.pages.pdf_order_return} Url of Pdf order return
{$urls.pages.pdf_order_slip} Url of Pdf order slip
{$urls.pages.prices_drop} Url of "Our Offers" page
{$urls.pages.product} Url of the "Product" page
{$urls.pages.search} Url of the "Search" page
{$urls.pages.sitemap} Url of thr "Site Map" page
{$urls.pages.stores} Url of the "Shops/Our stores" page
{$urls.pages.supplier} Url of the "Suppliers" page
{$urls.pages.register} Url of the "Register" page
{$urls.pages.order_login} Url of the "Login" page
{$urls.theme_assets} Url of the "assets" directory of the theme
{$urls.actions.logout} Url to disconnect from the site (registered user)

Cart

{$cart.totals.total.amount}The total amount of the cart without currency (ex: 45,00)
{$cart.totals.total.value} The total amount of the cart with currency (ex: 45,00 €)
{$cart.totals.total_including_tax.amount} The total amount of the cart, including taxes, without currency (ex: 45,00)
{$cart.totals.total_including_tax.value} The total amount of the cart, including taxes, with currency (ex: 45,00 €)
{$cart.totals.total_excluding_tax.amount} The total amount of the cart, excluding taxes, without currency (esempio: 35,70)
{$cart.totals.total_excluding_tax.value} The total amount of the cart, excluding taxes, with currency (esempio: 35,70 €)
{$cart.products_count} Number of products in the cart
{$cart.subtotals.products.amount} The amount of products in the cart without currency
{$cart.subtotals.products.value} The amount of products in the cart withcurrency
{$cart.subtotals.shipping.amount} The amount of shipping in the cart without currency
{$cart.subtotals.shipping.value} The amount of shipping in the cart with currency

Customers

{$customer.lastname} Customer Last Name
{$customer.firstname} Customer First Name
{$customer.email} Customer Email (provided during the registration)
{$customer.birthday} Customer Birthday
{$customer.newsletter} Subscribed to the newsletter (1 if subscribed, 0 if unsubscribed)
{$customer.newsletter_date_add} Newsletter subscription date
{$customer.ip_registration_newsletter} IP of Customers at the newsletter registration
{$customer.optin} Subscribed to offers from partners (1 if subscribed, 0 if unsubscribed)
{$customer.date_add} Customer registration
{$customer.date_upd} Last updated (customer registration)
{$customer.id} Customer ID
{$customer.id_default_group} ID group to which the client is associated
{$customer.is_logged} Check if the client is "logged in" (1 yes, 0 no)
{$customer.gender.name[$customer.gender.id]} Client Gender (example: Ms, Mr, etc.)
{$customer.addresses[AddressID].city} Client City of address with an ID (AddressID, example 8, where 8 is the ID of the customer's address), because a client could have multiple addresses)
{$customer.addresses[AddressID].alias} Address alias
{$customer.addresses[AddressID].firstname} Address Holder first name
{$customer.addresses[AddressID].lastname} Address Holder last name
{$customer.addresses[AddressID].company} Address Holder company
{$customer.addresses[AddressID].address1} Address Holder address 1
{$customer.addresses[AddressID].address2} Address Holder address 2
{$customer.addresses[AddressID].postcode} Address Holder ZIP code
{$customer.addresses[AddressID].id_state} Address Holder ID state
{$customer.addresses[AddressID].state} Address Holder state name
{$customer.addresses[AddressID].state_iso} Address Holder state ISO code
{$customer.addresses[AddressID].id_country} Address Holder ID country
{$customer.addresses[AddressID].country} Address Holder country name
{$customer.addresses[AddressID].country_iso} Address Holder ISO country
{$customer.addresses[AddressID].phone} Address Holder telephone
{$customer.addresses[AddressID].phone_mobile} Address Holder mobile phone
{$customer.addresses[AddressID].dni} Address Holder DNI
{$customer.addresses[AddressID].vat_number} Address Holder VAT number
{$customer.addresses[AddressID].formatted} Address Holder formatted address

Prestashop 1.7: examples of conditions

Now, with the smarty variables used by Prestashop, you can display an element based on a condition or not.

Show an item if the page you are viewing is the home page

{if $page.page_name == 'index'}
  content to show
{/if}

Show an item if the page you are viewing is a content page (CMS)

{if $page.page_name == 'cms'}
  content to show
{/if}

Show an item if the page you are viewing is the cart page

{if $page.page_name == 'cart'}
  content to show
{/if}

Show an item if the user is logged in (login)

{if $customer.is_logged}
  content to show
{/if}

Show a translatable welcome message and the name if the user has logged in

{if $customer.is_logged && $customer.firstname} 
  {l s='Hi' d='Shop.Theme.Global'} {$customer.firstname}
{/if}

Show a translatable message depending on whether the user is registered or not to the Newsletter

{if $customer.newsletter == 0}
  {l s='Sign up to our newsletter!' d='Shop.Theme.Customeraccount'}
{else}
  {l s='You are already subscribed to our newsletter' d='Shop.Theme.Customeraccount'}
{/if}

Src: https://www.themebooster.com/prestashop-tutorials/prestashop-1-7-smarty-global-variables/

Convert Smarty to Twig

If you need to convert above variable to twig, there is PrestaShop documentation explaining the this process:
https://devdocs.prestashop.com/1.7/development/architecture/migration-guide/templating-with-twig/

Custom Pretty URL in module PrestaShop

Sklep e-commerce i dropshipping do Polski z Aliexpress

Nasza firma dostarcza wdrożenia systemów integrujących produkty ze stron takich jak Aliexpress w formie dropshipping – czyli bezpośredniej sprzedaży z magazynu dostawcy (wysyłka bezobsługowa). Klient wchodzi na naszą stronę, gdzie jest zaprezentowana oferta, następnie zamawia produkt po cenie jaką ustalimy dla grupy np. x1.8 ceny ze strony Aliexpress + X zł a następnie przesyłamy naszemu dostawcy przelew oraz dane do wysyłki naszego klienta. W zależności od lokalizacji naszego dostawcy, sprzedaż będzie trwała X dni. Dostawcy z chin mogą wysyłać produkt nawet koło miesiąca.

Czas realizacji zlecenia dropshipping z Chin

Czas dotarcia produktu z Chin do klienta w Polsce może oscylować nawet w okolicach 50 dni (średnio 30 dni) ale zdąża się również, że czas ten może trwać zaledwie dwa tygodnie. Tak czy inaczej taki termin jest problematyczny dla naszych klientów, dlatego musimy poinformować ich o terminie dostawy w bardzo wyraźny i nie budzący wątpliwości sposób.

Jak skrócić czas wysyłki dropshipping?

Cudów nie ma. Trzeba wybrać odpowiedniego dostawcę lub zachęcić klientów stosunkowo niską ceną jednocześnie upewniając się, że są świadomi czasu jaki będą musieli czekać na dostawę.

Dlatego zaleca się aby produkty najbardziej chodliwe były zakupione na magazyn w celu szybkiej realizacji zlecenia. Ewentualnie można również wybrać dostawcę na terenie UE co znacznie skróci termin dostawy produktów. Czyli mamy firmę w chinach, która posiada punkt dropshipping w Europie a najlepiej w Polsce.

Ilość produktów na start

Za darmo mogą Państwo pobrać do 50 produktów na swój sklep, po przekroczeniu tego limitu mogą zaistnieć niewielkie dopłaty za korzystanie z importera produktów ze strony aliexpress.pl.

Jak ustalić cenę produktów aby nie stracić?

Co należy wiedzieć o cłach i podatkach i jak ustalić cenę tak aby zarobić. Należy również pamiętać, że do ceny trzeba wliczyć potencjalny odsetek zwrotów towaru, który zgodnie z prawem przysługuje w większości produktów sprzedawanych na odległość, z wykluczeniem produktów realizowanych na zamówienie i kilku innych grup produktów.


Podatki i dropshipping:

Polecamy zapoznać się z poniższymi wpisami na temat podatków i opłat oraz sposobu ich naliczeń jakie trzeba uwzględnić przy importowaniu produktów i sprzedaży produktów importowanych z chin w systemie dropshipping.

Inne przydatne integracje np. Allegro, rozliczenia faktur (tylko wybrane platformy) za pośrednictwem zewnętrznego magazynu.

Możliwości jest wiele. Automatyzacja to dzisiaj podstawa dobrze prosperującego biznesu.

Ty też jesteś zainteresowany dropshippingiem? Zapraszamy do kontaktu.

Wycena sklepu internetowego

Ile kosztuje sklep internetowy?

Ceny sklepu internetowego są dość rozbieżne. W internecine znajdą Państwo oferty od 1600 do 8000 zł, kilku dziesięciu a nawet kilku set tysięcy złotych. Jakie są różnice i co można kupić w tych różnych przedziałach cenowych?

Proszę mieć świadomość, że cena zazwyczaj idzie w parze z zakresem usługi oraz rodzajem, wyglądem i funkcjonalnością rozwiązania. Bardzo prosty sklep można postawić za stosunkowo niewielkie pieniądze, ale jak coś ma wyglądać być funkcjonalne i jeszcze oczekuje Pani jakiejś pomocy oraz wprowadzenia produktów na sklep czy integracji z hurtowniami zewnętrznymi to trzeba zapłacić więcej. W zamian ma Pani spokojną głowę jak i nie musi marnować czasu na czynności, które można zautomatyzować. Zapłaci dwa razy bo pierwszy sklep nie spełnia oczekiwań to żadna oszczędność.

Jaki sklep internetowy?

Na początku trzeba skonsultować własne wymagania i potrzeby a następnie złożyć zapytanie o wycenę, już konkretniej ze szczegółami. Inaczej wpadną Państwo w pułapkę tanio i byle jak, czyli straci pani pieniądze na rozwiązanie, które nie spełnia Państwa oczekiwań.

Nie deklarując pewnych funkcjonalności na początku nie mogą Państwo również oczekiwać, że takie rozwiązania zostaną dostarczone w trakcie realizacji. Czasami może okazać się, że dana funkcjonalność nie jest dostępna we wdrażanym systemie a jej indywidualna implementacja może znacznie przewyższyć cenę budowy samego sklepu.

Jaka platforma e-commerce

Na rynku mamy dostępne wiele rozwiązań z różnymi modelami płatności. Płatność za wynajem sklepu lub koszt wdrożenia sklepu na jednej z popularnych platform e-commerce. Ewentualnie budowa własnego sklepu (ta opcja jest już bardzo droga i przeznaczona głównie dla dużych firm mających duży budżet inwestycyjny)

Wynajem sklepu:
– https://www.shopify.com (cena w tabeli poniżej)
– https://sky-shop.pl

Basic ShopifyAll the basics for starting a new businessShopifyEverything you need for a growing businessAdvanced ShopifyAdvanced features for scaling your business
USD $29 per month/moUSD $79 per month/moUSD $299 per month/mo
Shopify Plany / koszt na miesiąc na dzień 8/03/2021


Basic Dynamicznie rozwijający się e-sklep

99 zł miesiąc / netto
Business Pakiet idealny dla Allegrowiczów i Dropshippingu

187 zł miesiąc / netto
Advance Większe możliwości dla rosnącego sklepu internetowego

299 zł miesiąc / netto
Shopify Plany / koszt na miesiąc na dzień 8/03/2021

* Łatwo policzyć, że roczny koszt to minimum 1500 zł zł netto za najuboższą opcję / płatność roczna. Czyli bardzo bliski koszt wdrożenia sklepu w systemie WooCommerce w najuboższej wersji (patrz lista poniżej) / płatność jednorazowa.

Własny sklep:
Wdrożenie jednego z systemów:
– WooCommerce (2000 – XX XXX zł w zależności od wymagań klienta)
– PrestaShop (3500 – XX XXX zł w zależności od wymagań klienta)
– Magento (8000 – XXX XXX zł w zależności od wymagań klienta)
* Należy pamiętać, że przy cenie startowej otrzymujemy jedynie działający system bez dodatkowej funkcjonalności czy też wyszukanego szablonu graficznego.

Budowa własnego rozwiązania w oparciu o specyficzne technologie i frameworki (tylko dla dużych firm):
LAMP lub MEAN
React, Angular, Symfony
MySQL, Mongo, Firebase
Cena od 60 000 zł do X XXX XXX w zależności od wymagań klienta)

Z reguły implementacje sklepu na znanej platformie jest początkowo droższa ale tańsza na przestrzeni czasu. Nie należy jednak nastawiać się na jazdę próbną na jednym rozwiązaniu i przejście na drugie bo często takie transfery są trudne lub nawet niemożliwe albo zwyczajnie kosztowne pochłaniają nie tylko środki ale i czas.

Dobrze wiec obrać dobrą strategię na samym początku.