Skip to content
Code-Schnipsel Gruppen Projekte
Commit 10d5abd9 erstellt von Michael Danielczok's avatar Michael Danielczok
Dateien durchsuchen

feat: Shipping information added #36

Übergeordneter 00c8d092
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
/**
* Shipping information control.
* Show shipping information popup after click.
*
* @module package/quiqqer/shipping/bin/frontend/controls/ShippingInfo
* @author www.pcsg.de (Michael Danielczok)
*/
define('package/quiqqer/shipping/bin/frontend/controls/ShippingInfo', [
'qui/QUI',
'qui/controls/Control',
'Locale'
], function (QUI, QUIControl, QUILocale) {
"use strict";
return new Class({
Extends: QUIControl,
Type : 'package/quiqqer/shipping/bin/frontend/controls/ShippingInfo',
Binds: [
'showInfo',
'$onImport'
],
initialize: function (options) {
this.parent(options);
this.addEvents({
onImport: this.$onImport
});
},
/**
* event on import
*/
$onImport: function () {
this.getElm().addEvent('click', this.showInfo);
},
/**
* Show shpping information popup
*
* @param event
*/
showInfo: function (event) {
event.stop();
require([
'qui/controls/windows/Popup'
], function (QUIConfirm) {
new QUIConfirm({
'maxWidth' : 700,
'maxHeight': 600,
'icon' : false,
'title' : false,
'content' : QUILocale.get('quiqqer/shipping', 'frontend.shippingInfo.popup.content'),
draggable : false,
resizable : false
}).open();
});
}
});
});
......@@ -28,4 +28,8 @@
<event on="onQuiqqer::order::orderProcessCustomerDataEnd"
fire="\QUI\ERP\Shipping\EventHandler::onOrderProcessCustomerDataEnd"
/>
<event on="onQuiqqer::products::price::end"
fire="\QUI\ERP\Shipping\EventHandler::onQuiqqerProductsPriceEnd"
/>
</events>
......@@ -122,6 +122,7 @@
<de><![CDATA[Bitte wählen Sie eine Versandart aus.]]></de>
<en><![CDATA[Please select a shipping method.]]></en>
</locale>
<locale name="shipping.mail.settings.title">
<de><![CDATA[Bestell Verhalten]]></de>
<en><![CDATA[Order behavior]]></en>
......@@ -263,6 +264,31 @@
<de><![CDATA[Versandstatus]]></de>
<en><![CDATA[Shipping status]]></en>
</locale>
<locale name="frontend.shippingInfo.button.text">
<de><![CDATA[zzgl. Versand]]></de>
<en><![CDATA[plus shipping]]></en>
</locale>
<locale name="frontend.shippingInfo.popup.content" html="true">
<de><![CDATA[<h2>Kostenloser Versand in Deutschland</h2>
<p>Bei uns sind alle Bestellungen innerhalb Deutschlands versandkostenfrei! Wir versenden innerhalb Deutschlands per <strong>DHL Warenpost</strong> oder <strong>Deutsche Post Warenpost</strong>.</p>
<h2>Lieferzeit</h2>
<p>Die Artikel werden innerhalb von 1 bis 2 Werktagen nach Eingang der Bestellung versendet. Wir versenden nicht an Samstagen sowie Sonn- und Feiertagen.</p>
<p>Die Lieferzeit beträgt, sofern nicht beim Angebot anders angegeben, innerhalb Deutschlands 3-6 Werktage. Sie erhalten zusätzlich eine E-Mail, wenn Ihre Ware unser Lager verlässt. Diese enthält eine Trackingnummer, mit der Sie jederzeit Ihre Sendung online verfolgen können.</p>
<p class="content-message-information">Bitte beachte: Die Lieferzeiten erlauben lediglich eine geschätzte Ankunftszeit nach dem Versand!</p>]]>
</de>
<en><![CDATA[<h2>Free Shipping in Germany</h2>
<p>With us, all orders within Germany are free of shipping costs! We ship within Germany by <strong>DHL Warenpost</strong> or <strong>Deutsche Post Warenpost</strong>.</p>
<h2>Delivery time</h2>.
<p>Items will be shipped within 1 to 2 business days after we receive your order. We do not ship on Saturdays and Sundays and holidays.</p>
<p>The delivery time is 3-6 business days within Germany, unless otherwise stated in the offer. You will also receive an email when your goods leave our warehouse. This contains a tracking number, with which you can track your shipment online at any time.</p>.
<p class="content-message-information">Please note: The delivery times only allow an estimated time of arrival after shipping!</p>]]>
</en>
</locale>
</groups>
<groups name="quiqqer/shipping" datatype="php">
......@@ -387,6 +413,31 @@
<![CDATA[Determines the default value for the "Delivery time" field for newly created products or if no field value is set.]]></en>
</locale>
<locale name="shipping.settings.showShippingInfoAfterPrice.enable">
<de><![CDATA[Versandinformation aktivieren]]></de>
<en><![CDATA[Active shipping information]]></en>
</locale>
<locale name="shipping.settings.showShippingInfoAfterPrice.enable.description">
<de><![CDATA[Wenn aktiviert, wird hinter jedem Preis ein kleiner Text angezeigt, den man klicken kann um mehr Informationen zu erhalten.]]></de>
<en><![CDATA[If enabled, a small text is displayed behind each price, which you can click to get more information.]]></en>
</locale>
<locale name="shipping.settings.showShippingInfoAfterPrice.button">
<de><![CDATA[Button Text]]></de>
<en><![CDATA[Button text]]></en>
</locale>
<locale name="shipping.settings.showShippingInfoAfterPrice.button.desc">
<de><![CDATA[Dieser Text erscheint hinter dem Preis]]></de>
<en><![CDATA[This text is appears after price]]></en>
</locale>
<locale name="shipping.settings.showShippingInfoAfterPrice.popup">
<de><![CDATA[Popup Inhalt]]></de>
<en><![CDATA[Popup content]]></en>
</locale>
<locale name="shipping.settings.showShippingInfoAfterPrice.popup.desc">
<de><![CDATA[Popup für mehr Informationen. Der Text kann kurz sein aber es sind auch längere Texte mit Tabellen möglich.]]></de>
<en><![CDATA[Popup for more information. The text can be short but longer texts with tables are also possible.]]></en>
</locale>
<locale name="shipping.order.title">
<de><![CDATA[Versand: [shipping]]]></de>
<en><![CDATA[Shipping: [shipping]]]></en>
......
......@@ -20,6 +20,10 @@
<defaultvalue>
<![CDATA[{"from":"","to":"","unit":"second","option":"immediately_available"}]]></defaultvalue>
</conf>
<conf name="showShippingInfoAfterPrice">
<type><![CDATA[bool]]></type>
<defaultvalue>0</defaultvalue>
</conf>
</section>
<section name="no_rules">
......@@ -96,6 +100,46 @@
var="shipping.settings.deliveryTimeDefault.description"/>
</description>
</input>
<input type="checkbox" conf="shipping.showShippingInfoAfterPrice">
<text>
<locale group="quiqqer/shipping" var="shipping.settings.showShippingInfoAfterPrice.enable"/>
</text>
<description>
<locale group="quiqqer/shipping" var="shipping.settings.showShippingInfoAfterPrice.enable.description"/>
</description>
</input>
<input type="hidden"
data-qui="package/quiqqer/translator/bin/controls/Update"
data-qui-options-group="quiqqer/shipping"
data-qui-options-var="frontend.shippingInfo.button.text"
>
<text>
<locale group="quiqqer/shipping"
var="shipping.settings.showShippingInfoAfterPrice.button"/>
</text>
<description>
<locale group="quiqqer/shipping"
var="shipping.settings.showShippingInfoAfterPrice.button.desc"/>
</description>
</input>
<input type="hidden"
data-qui="package/quiqqer/translator/bin/controls/Update"
data-qui-options-group="quiqqer/shipping"
data-qui-options-var="frontend.shippingInfo.popup.content"
data-qui-options-html="1"
>
<text>
<locale group="quiqqer/shipping"
var="shipping.settings.showShippingInfoAfterPrice.popup"/>
</text>
<description>
<locale group="quiqqer/shipping"
var="shipping.settings.showShippingInfoAfterPrice.popup.desc"/>
</description>
</input>
</settings>
<settings title="mail" name="mail">
......
......@@ -9,6 +9,7 @@
use QUI;
use QUI\ERP\Products\Handler\Fields as ProductFields;
use QUI\ERP\Order\Controls\OrderProcess\Checkout as OrderCheckoutStepControl;
use QUI\Template;
use \Quiqqer\Engine\Collector;
/**
......@@ -426,4 +427,20 @@ protected static function createProductFields()
QUI\Translator::publish('quiqqer/products');
}
}
public static function onQuiqqerProductsPriceEnd(Collector $Collector, QUI\ERP\Products\Controls\Price $Price)
{
$Config = QUI::getPackage('quiqqer/shipping')->getConfig();
$enableShippingInfo = !!$Config->getValue('shipping', 'showShippingInfoAfterPrice');
if (!$enableShippingInfo || !$Price->getAttribute('withVatText')) {
return;
}
$Engine = QUI::getTemplateManager()->getEngine();
$html = $Engine->fetch(dirname(__FILE__).'/templates/shippingInformation.html');
$Collector->append($html);
}
}
<span class="quiqqer-shipping-shippingInformation-btn text-muted" role="button"
data-qui="package/quiqqer/shipping/bin/frontend/controls/ShippingInfo">
{locale group='quiqqer/shipping' var='frontend.shippingInfo.button.text'}
</span>
\ No newline at end of file
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren