From efe67d78a9ca2674e67d6450c97423e0e804c7e8 Mon Sep 17 00:00:00 2001 From: Denis Baudot Date: Tue, 8 Nov 2016 18:01:25 +0100 Subject: [PATCH 1/2] start the cross selling module --- .../antadisCrossSelling.php | 39 ++++++++++++++++++ modules/antadisCrossSelling/index.php | 35 ++++++++++++++++ modules/antadisCrossSelling/logo.gif | Bin 0 -> 778 bytes modules/antadisCrossSelling/logo.png | Bin 0 -> 2425 bytes .../templates/front/cartCrossSelling.tpl | 12 ++++++ themes/toutpratique/shopping-cart.tpl | 1 - 6 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 modules/antadisCrossSelling/antadisCrossSelling.php create mode 100755 modules/antadisCrossSelling/index.php create mode 100755 modules/antadisCrossSelling/logo.gif create mode 100755 modules/antadisCrossSelling/logo.png create mode 100644 modules/antadisCrossSelling/views/templates/front/cartCrossSelling.tpl diff --git a/modules/antadisCrossSelling/antadisCrossSelling.php b/modules/antadisCrossSelling/antadisCrossSelling.php new file mode 100644 index 00000000..8d48eabc --- /dev/null +++ b/modules/antadisCrossSelling/antadisCrossSelling.php @@ -0,0 +1,39 @@ +name = 'antadisCrossSelling'; + $this->tab = 'administration'; + $this->version = '1.0'; + $this->author = 'Antadis'; + $this->need_instance = 0; + + parent::__construct(); + + $this->displayName = $this->l('Antadis Cross Selling'); + $this->description = $this->l('Ajouter un élément au panier.'); + $this->secure_key = Tools::encrypt($this->name); + + $this->confirmUninstall = $this->l('Are you sure ?'); + } + + public function install() + { + return parent::install() && $this->registerHook('displayShoppingCart'); + } + + public function hookDisplayShoppingCart($params) + { + // ne fonctionne pas :( + $this->context->smarty->assign( + array( + 'product' => new Product(34), + ) + ); + return $this->display(__FILE__, 'cartCrossSelling.tpl'); + } +} \ No newline at end of file diff --git a/modules/antadisCrossSelling/index.php b/modules/antadisCrossSelling/index.php new file mode 100755 index 00000000..3f6561f7 --- /dev/null +++ b/modules/antadisCrossSelling/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/antadisCrossSelling/logo.gif b/modules/antadisCrossSelling/logo.gif new file mode 100755 index 0000000000000000000000000000000000000000..12cd1aef900803abba99b26920337ec01ad5c267 GIT binary patch literal 778 zcmV+l1NHogP)BVme|mWaqy4$_pJm?y9KM{-*hp?1+Ey3e-CEDooTa!B;e(Q>TSF?bj>5At13y1p zriN3w3x~5SfZj{@J4M{kp{?=M_Lh2bV+5LH)Q)5W!-ePA$RgE1@5f1cyHki0Y}JyVEYZF(LD$xXlt$7A5CgE@ zpV-&l%vf;=5kZ2-2gi@Y6J&=cuwt>!vJ^#(&n|LcZyUzi6Duj$$hJ1s*HD-#;k-w@ zpdrwAuoDG_N2bvb07G$Zk*?Hc)JLtW4yqOnic_$zO7NZ#l>Fm){;fE?b$IbOaX2fe z0la4g0Dfw2xk7Wi7NapVD8YMPCZu?A1QCK*67dgsvRKBLFtrM>?$%&_lD1882mzdO zWPdw5KWw6IT`m1b_8=lS5jt8D3=RDa=&jWzR-)S@56WMslZ~mKu1)-wpXB>rNBQ>N zU#K`#1B&v|_AQK;7I~B}OdGiUT9LX>f0xm6<;LeP!=vFjPsUQF*wCJ*dO)4YBypgdiuF!=i@6Zyi7F|q#K zz?tlSZULa@t1D?$e;f@b36&N!V2mjOHw|*!cfIZ$5EsMH4HugMa!d7 zz{n#&Fb{Ivh1^|okjuUH_I9`5f0Ls?0KuF2vYY+y|NH&E@Bh7)Q&kll$Ke)#y3xb$ z+$JlAX}l50BzW+8(j(9c52$oe=#L}=X_?dR4FVHoN6nE#Gif<eLv0a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z%tUJh{%Nw#NsKCzgmdXZ6Lx`%Bv)*1gaOb+9@Fw`qx1qH)OhnR}OPM5NooF~y52w?ibvvt_(y{h9St-%F z(gmC#;Fb{11=^6IjBvVK$n)fY>1R0IcyfR4(d;`9tJMUr z$Bl6CIO3`eB}Eo;w~VsB)D44FWKJA}&B!4bjvy9G!s>9r?RBv_52HZUUyb)@N4jf` z0qI190#Sff(7|ltkTU5=nGNx16la@Tpz2MqJIwG{0aRtFp1VK3oi#-RP zd^a^99wwT_*gT-H@r?9dH4gM7K=TWvREHLLRLH4?aTbRm`Fq`r`Wm5#z< zqEbV{fyHbfGBR{}D+Q%M#gHr}a6JVr3vyKpQ=v=mcM)JyLz-S>(GQNl#8}V9Jqt|a~SJG-RI0*fyJRqFURrUL4dS`1I@5gb5Rtv%Y~}ilL#BV85*O> z>I2VTvHpL9I8Au+64T4^Hzpw0`jV>@<deL9GD%C zL^Z+R)PnYKL^|b9t;rUHYmMa=l6;arm6P+Pk1Vl1?a6Z+3;N|#Rn+$&qEKiT_8kQO zxjG^s^Z?GJB?KsI!oi4mxIX^pH+KfN(<|pm*esB^76E1k&Hk{HxJi03A|pzy&*bIh z8Vd##P-+>p(JCu_@=I{OrT&r^n53mN0*wI#gYDvx`uLx^f!jzT-5(_)UJdyqLwl20wzWVFFIv5cp=ljIK>&AQ8zYA|-uMSV%|U zuY<4t9D*$b+;DTixAJLrJt8wkmRO#p9A}@U(&75VS^}=VS>RhGa6KZq-TyP7_FDn| rz67o&V(w05_PL$B72xdee*z2uV^Ka2=G{~v00000NkvXXu0mjf-t3t+ literal 0 HcmV?d00001 diff --git a/modules/antadisCrossSelling/views/templates/front/cartCrossSelling.tpl b/modules/antadisCrossSelling/views/templates/front/cartCrossSelling.tpl new file mode 100644 index 00000000..a88ecd0f --- /dev/null +++ b/modules/antadisCrossSelling/views/templates/front/cartCrossSelling.tpl @@ -0,0 +1,12 @@ +
+
+
+ + +
+
+ {$product.name|strip} +
+ +
+
\ No newline at end of file diff --git a/themes/toutpratique/shopping-cart.tpl b/themes/toutpratique/shopping-cart.tpl index af1f9ca2..bf766640 100644 --- a/themes/toutpratique/shopping-cart.tpl +++ b/themes/toutpratique/shopping-cart.tpl @@ -3,7 +3,6 @@
- {include file="$tpl_dir./order-steps.tpl" current_step="summary"}
From f6c16fe8ee5eea7711850b1a0ad180521a648d97 Mon Sep 17 00:00:00 2001 From: Thibault UBUNTU Date: Wed, 9 Nov 2016 12:58:06 +0100 Subject: [PATCH 2/2] module cross selling --- .../antadisCrossSelling.php | 39 --------------- .../templates/front/cartCrossSelling.tpl | 12 ----- .../antadis_cross_selling.php | 47 ++++++++++++++++++ .../index.php | 0 .../logo.gif | Bin .../logo.png | Bin .../templates/front/cartCrossSelling.tpl | 20 ++++++++ themes/toutpratique/css/global.css | 20 +++++++- themes/toutpratique/shopping-cart.tpl | 3 +- 9 files changed, 87 insertions(+), 54 deletions(-) delete mode 100644 modules/antadisCrossSelling/antadisCrossSelling.php delete mode 100644 modules/antadisCrossSelling/views/templates/front/cartCrossSelling.tpl create mode 100644 modules/antadis_cross_selling/antadis_cross_selling.php rename modules/{antadisCrossSelling => antadis_cross_selling}/index.php (100%) mode change 100755 => 100644 rename modules/{antadisCrossSelling => antadis_cross_selling}/logo.gif (100%) mode change 100755 => 100644 rename modules/{antadisCrossSelling => antadis_cross_selling}/logo.png (100%) mode change 100755 => 100644 create mode 100644 modules/antadis_cross_selling/views/templates/front/cartCrossSelling.tpl diff --git a/modules/antadisCrossSelling/antadisCrossSelling.php b/modules/antadisCrossSelling/antadisCrossSelling.php deleted file mode 100644 index 8d48eabc..00000000 --- a/modules/antadisCrossSelling/antadisCrossSelling.php +++ /dev/null @@ -1,39 +0,0 @@ -name = 'antadisCrossSelling'; - $this->tab = 'administration'; - $this->version = '1.0'; - $this->author = 'Antadis'; - $this->need_instance = 0; - - parent::__construct(); - - $this->displayName = $this->l('Antadis Cross Selling'); - $this->description = $this->l('Ajouter un élément au panier.'); - $this->secure_key = Tools::encrypt($this->name); - - $this->confirmUninstall = $this->l('Are you sure ?'); - } - - public function install() - { - return parent::install() && $this->registerHook('displayShoppingCart'); - } - - public function hookDisplayShoppingCart($params) - { - // ne fonctionne pas :( - $this->context->smarty->assign( - array( - 'product' => new Product(34), - ) - ); - return $this->display(__FILE__, 'cartCrossSelling.tpl'); - } -} \ No newline at end of file diff --git a/modules/antadisCrossSelling/views/templates/front/cartCrossSelling.tpl b/modules/antadisCrossSelling/views/templates/front/cartCrossSelling.tpl deleted file mode 100644 index a88ecd0f..00000000 --- a/modules/antadisCrossSelling/views/templates/front/cartCrossSelling.tpl +++ /dev/null @@ -1,12 +0,0 @@ -
-
-
- - -
-
- {$product.name|strip} -
- -
-
\ No newline at end of file diff --git a/modules/antadis_cross_selling/antadis_cross_selling.php b/modules/antadis_cross_selling/antadis_cross_selling.php new file mode 100644 index 00000000..89f4c620 --- /dev/null +++ b/modules/antadis_cross_selling/antadis_cross_selling.php @@ -0,0 +1,47 @@ +name = 'antadis_cross_selling'; + $this->tab = 'administration'; + $this->version = '1.0'; + $this->author = 'Antadis'; + + parent::__construct(); + + $this->displayName = $this->l('Antadis Cross Selling'); + $this->description = $this->l('Ajouter un élément au panier.'); + $this->secure_key = Tools::encrypt($this->name); + + $this->confirmUninstall = $this->l('Are you sure ?'); + } + + public function install() + { + return parent::install() && $this->registerHook('displayProductLineShoppingCart'); + } + + public function hookdisplayProductLineShoppingCart($params) + { + $id_product = 34; + $cart = Context::getContext()->cart; + $product = new Product($id_product, true, Context::getContext()->language->id); + $image = Image::getCover($product->id); + $product->id_image = $image['id_image']; + + + if (empty($cart->containsProduct($product->id))) { + $this->context->smarty->assign( + array( + 'product' => $product + ) + ); + return $this->display(__FILE__, 'cartCrossSelling.tpl'); + } + } + +} diff --git a/modules/antadisCrossSelling/index.php b/modules/antadis_cross_selling/index.php old mode 100755 new mode 100644 similarity index 100% rename from modules/antadisCrossSelling/index.php rename to modules/antadis_cross_selling/index.php diff --git a/modules/antadisCrossSelling/logo.gif b/modules/antadis_cross_selling/logo.gif old mode 100755 new mode 100644 similarity index 100% rename from modules/antadisCrossSelling/logo.gif rename to modules/antadis_cross_selling/logo.gif diff --git a/modules/antadisCrossSelling/logo.png b/modules/antadis_cross_selling/logo.png old mode 100755 new mode 100644 similarity index 100% rename from modules/antadisCrossSelling/logo.png rename to modules/antadis_cross_selling/logo.png diff --git a/modules/antadis_cross_selling/views/templates/front/cartCrossSelling.tpl b/modules/antadis_cross_selling/views/templates/front/cartCrossSelling.tpl new file mode 100644 index 00000000..15bc9438 --- /dev/null +++ b/modules/antadis_cross_selling/views/templates/front/cartCrossSelling.tpl @@ -0,0 +1,20 @@ +
+
+ + {$product->name|escape:'html':'UTF-8'} + +
+ + + +
\ No newline at end of file diff --git a/themes/toutpratique/css/global.css b/themes/toutpratique/css/global.css index 92cd602d..f310e632 100644 --- a/themes/toutpratique/css/global.css +++ b/themes/toutpratique/css/global.css @@ -4553,9 +4553,25 @@ main#categorycms { margin-bottom: 30px } #shopping-cart #calcul.table-row { margin: 10px -15px 0 -15px; } - - +#shopping-cart #shopping-cart-products .product_cross_selling { + background: #f6f0f0 +} +#shopping-cart #shopping-cart-products .product_cross_selling .price { + color: #e4535d; +} +#shopping-cart #shopping-cart-products .product_cross_selling .ajax_add_to_cart_button { + border: 1px solid; + cursor: pointer; + font-family: "pompiere_regular"; + padding: 8px 15px; + text-transform: uppercase; + float: right; + margin-right: 30px; +} +#shopping-cart #shopping-cart-products .product_cross_selling .ajax_add_to_cart_button:hover { text-decoration: none;} +#shopping-cart #shopping-cart-products .product_cross_selling .ajax_add_to_cart_button:hover { background: #e4535d; color:#fff; } + @media (min-width: 1399px) { #shopping-cart .table-head .text-right, #shopping-cart #shopping-cart-products .total { padding-right: 50px; diff --git a/themes/toutpratique/shopping-cart.tpl b/themes/toutpratique/shopping-cart.tpl index bf766640..37a44103 100644 --- a/themes/toutpratique/shopping-cart.tpl +++ b/themes/toutpratique/shopping-cart.tpl @@ -85,9 +85,10 @@ > {/foreach} {/if} - {/foreach} + {hook h='displayProductLineShoppingCart'} + {foreach $gift_products as $product} {include file="$tpl_dir./shopping-cart-product-line.tpl" product=$product} {/foreach}