X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   General questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=66)
-   -   Date Picker in Customer Zone (https://forum.x-cart.com/showthread.php?t=76054)

Soptareanu Alex 03-02-2018 08:34 AM

Date Picker in Customer Zone
 
Hello. I need to include datepicker plugin into my customer zone, in order to show a calendar intro checkout page.
This is my View Class :
<?php
// vim: set ts=4 sw=4 sts=4 et:

/**
* Copyright (c) 2011-present Qualiteam software Ltd. All rights reserved.
* See https://www.x-cart.com/license-agreement.html for license details.
*/

namespace XLite\Module\XGhosty\Disponibility\View\Checkout;

use \XLite\Core\Database as _Db;

/**
* Cart items
*
* @ListChild (list="checkout.shipping.selected.sub.payment", weight="1000", zone="customer")
*/

class Calendar extends \XLite\View\AView
{
/**
* Return widget default template
*
* @return string
*/
protected function getDefaultTemplate()
{
return 'modules/XGhosty/Disponibility/checkout/calendar.twig';
}

/**
* Register CSS files
*
* @return array
*/
public function getCSSFiles()
{
$list = parent::getCSSFiles();
$list[] = 'modules/XGhosty/Disponibility/assets/css/jquery.datepick.css';

return $list;
}

/**
* Get JS files
*
* @return array
*/
public function getJSFiles()
{
$list = parent::getJSFiles();
$list[] = 'modules/XGhosty/Disponibility/assets/js/jquery.plugin.min.js'; // Aici imi pun js-urile mele
$list[] = 'modules/XGhosty/Disponibility/assets/js/jquery.datepick.min.js'; // Aici imi pun js-urile mele

return $list;
}

/**
* Get cart items
*
* @return array
*/
public function getItems()
{
return $this->getCart()
? $this->getCart()->getItems()
: [];
}
}

The problem is that .js and .css resources didn't load in my layout.
This is my twig file :
{% if this.showDeliveryDate() is not null %}
<div>
<span> Delivery date is : <b> {{ this.showDeliveryDate() }} </b> </span>
</div>
{% endif %}
<script>

$(function(){
console.log("asd");
});

$(document).ready(function(){
$('#defaultPopup').datepick({minDate: new Date(2014, 12-1, 25)}); // This is how I want to init my plugin in page !!
});


All times are GMT -8. The time now is 04:39 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.