本文整理汇总了PHP中JSFactory::getAllDeliveryTimeDays方法的典型用法代码示例。如果您正苦于以下问题:PHP JSFactory::getAllDeliveryTimeDays方法的具体用法?PHP JSFactory::getAllDeliveryTimeDays怎么用?PHP JSFactory::getAllDeliveryTimeDays使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSFactory
的用法示例。
在下文中一共展示了JSFactory::getAllDeliveryTimeDays方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveShippingData
public function saveShippingData($sh_pr_method_id, &$allparams, &$adv_user)
{
$jshopConfig = JSFactory::getConfig();
$cart = $this->getCart();
$shipping_method_price = JSFactory::getTable('shippingMethodPrice', 'jshop');
$shipping_method_price->load($sh_pr_method_id);
$sh_method = JSFactory::getTable('shippingMethod', 'jshop');
$sh_method->load($shipping_method_price->shipping_method_id);
if (!$shipping_method_price->sh_pr_method_id) {
$this->setError(_JSHOP_ERROR_SHIPPING);
return 0;
}
$id_country = $this->getAnyIdCountry($adv_user);
if (!$shipping_method_price->isCorrectMethodForCountry($id_country)) {
$this->setError(_JSHOP_ERROR_SHIPPING);
return 0;
}
if (!$sh_method->shipping_id) {
$this->setError(_JSHOP_ERROR_SHIPPING);
return 0;
}
$params = $allparams[$sh_method->shipping_id];
if (isset($params)) {
$cart->setShippingParams($params);
} else {
$cart->setShippingParams('');
}
$shippingForm = $sh_method->getShippingForm();
if ($shippingForm && !$shippingForm->check($params, $sh_method)) {
$this->setError($shippingForm->getErrorMessage());
return 0;
}
$prices = $shipping_method_price->calculateSum($cart);
$cart->setShippingId($sh_method->shipping_id);
$cart->setShippingPrId($sh_pr_method_id);
$cart->setShippingsDatas($prices, $shipping_method_price);
if ($jshopConfig->show_delivery_date) {
$delivery_date = '';
$deliverytimedays = JSFactory::getAllDeliveryTimeDays();
$day = $deliverytimedays[$shipping_method_price->delivery_times_id];
if ($day) {
$delivery_date = getCalculateDeliveryDay($day);
} else {
if ($jshopConfig->delivery_order_depends_delivery_product) {
$day = $cart->getDeliveryDaysProducts();
if ($day) {
$delivery_date = getCalculateDeliveryDay($day);
}
}
}
$cart->setDeliveryDate($delivery_date);
}
//update payment price
if ($cart->getPaymentId()) {
$paym_method = $this->getPaymentMethod();
$cart->setDisplayItem(1, 1);
$paym_method->setCart($cart);
$price = $paym_method->getPrice();
$cart->setPaymentDatas($price, $paym_method);
}
$adv_user->saveTypeShipping($sh_method->shipping_id);
$this->setActiveShippingMethod($sh_method);
$this->setActiveShippingMethodPrice($shipping_method_price);
return 1;
}
示例2: step4save
function step4save()
{
$checkout = JModelLegacy::getInstance('checkout', 'jshop');
$checkout->checkStep(4);
$session = JFactory::getSession();
$jshopConfig = JSFactory::getConfig();
JPluginHelper::importPlugin('jshoppingcheckout');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeSaveCheckoutStep4save', array());
$cart = JModelLegacy::getInstance('cart', 'jshop');
$cart->load();
$user = JFactory::getUser();
if ($user->id) {
$adv_user = JTable::getInstance('userShop', 'jshop');
$adv_user->load($user->id);
} else {
$adv_user = JSFactory::getUserShopGuest();
}
if ($adv_user->delivery_adress) {
$id_country = $adv_user->d_country;
} else {
$id_country = $adv_user->country;
}
if (!$id_country) {
$id_country = $jshopConfig->default_country;
}
$sh_pr_method_id = JRequest::getInt('sh_pr_method_id');
$shipping_method_price = JTable::getInstance('shippingMethodPrice', 'jshop');
$shipping_method_price->load($sh_pr_method_id);
$sh_method = JTable::getInstance('shippingMethod', 'jshop');
$sh_method->load($shipping_method_price->shipping_method_id);
if (!$shipping_method_price->sh_pr_method_id) {
JError::raiseWarning("", _JSHOP_ERROR_SHIPPING);
$this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step4', 0, 1, $jshopConfig->use_ssl));
return 0;
}
if (!$shipping_method_price->isCorrectMethodForCountry($id_country)) {
JError::raiseWarning("", _JSHOP_ERROR_SHIPPING);
$this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step4', 0, 1, $jshopConfig->use_ssl));
return 0;
}
if (!$sh_method->shipping_id) {
JError::raiseWarning("", _JSHOP_ERROR_SHIPPING);
$this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step4', 0, 1, $jshopConfig->use_ssl));
return 0;
}
$prices = $shipping_method_price->calculateSum($cart);
$cart->setShippingId($sh_method->shipping_id);
$cart->setShippingPrId($sh_pr_method_id);
$cart->setShippingsDatas($prices, $shipping_method_price);
if ($jshopConfig->show_delivery_date) {
$delivery_date = '';
$deliverytimedays = JSFactory::getAllDeliveryTimeDays();
$day = $deliverytimedays[$shipping_method_price->delivery_times_id];
if ($day) {
$delivery_date = getCalculateDeliveryDay($day);
} else {
if ($jshopConfig->delivery_order_depends_delivery_product) {
$day = $cart->getDeliveryDaysProducts();
if ($day) {
$delivery_date = getCalculateDeliveryDay($day);
}
}
}
$cart->setDeliveryDate($delivery_date);
}
//update payment price
$payment_method_id = $cart->getPaymentId();
if ($payment_method_id) {
$paym_method = JTable::getInstance('paymentmethod', 'jshop');
$paym_method->load($payment_method_id);
$cart->setDisplayItem(1, 1);
$paym_method->setCart($cart);
$price = $paym_method->getPrice();
$cart->setPaymentDatas($price, $paym_method);
}
$adv_user->saveTypeShipping($sh_method->shipping_id);
$dispatcher->trigger('onAfterSaveCheckoutStep4', array(&$adv_user, &$sh_method, &$shipping_method_price, &$cart));
if ($jshopConfig->step_4_3 && !$jshopConfig->without_payment) {
$checkout->setMaxStep(3);
$this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step3', 0, 1, $jshopConfig->use_ssl));
} else {
$checkout->setMaxStep(5);
$this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step5', 0, 1, $jshopConfig->use_ssl));
}
}
示例3: getDeliveryDaysProducts
function getDeliveryDaysProducts()
{
$deliverytimes = JSFactory::getAllDeliveryTime();
$deliverytimesdays = JSFactory::getAllDeliveryTimeDays();
$day = 0;
foreach ($this->products as $prod) {
if ($prod['delivery_times_id']) {
if ($deliverytimesdays[$prod['delivery_times_id']] > $day) {
$day = $deliverytimesdays[$prod['delivery_times_id']];
}
}
}
return $day;
}