The followings are the available columns in table 'reward':
Inheritance: extends CActiveRecord
コード例 #1
0
 public function actionChngShiping()
 {
     $id = $_GET['id'];
     $carrier_id = $_GET['carrier_name'];
     $carrier_name = $_GET['carrier_id'];
     $Shipping = new Shipping();
     $item = $Shipping->GetShipping($id);
     if (!empty($item['carriers_id'])) {
         $carriers_id_arr = explode(', ', $item['carriers_id']);
         array_push($carriers_id_arr, $carrier_id);
         $res = array_unique($carriers_id_arr);
         $final_carriers_id = implode(', ', $res);
     } else {
         $final_carriers_id = $carrier_id;
     }
     if (!empty($item['carrier_name'])) {
         $carriers_name_arr = explode('|', $item['carrier_name']);
         array_push($carriers_name_arr, $carrier_id);
         $res = array_unique($carriers_name_arr);
         $final_carriers_name = implode('|', $res);
     } else {
         $final_carriers_name = $carrier_name;
     }
     $post = Shipping::model()->findByPk($id);
     $post->carriers_id = $final_carriers_id;
     $post->carrier_name = $final_carriers_name;
     // $Shipping->route = $item['route'];
     //  $Shipping->comment = $item['comment'];
     $r = $post->save();
     //  var_dump($post->errors);die;
 }
コード例 #2
0
ファイル: shippings.php プロジェクト: vosaan/ankor.local
 /**
  * The index handler.
  * 
  * @access public
  * @return string The HTML code.
  */
 public function index()
 {
     $Shipping = new Shipping();
     $params = array();
     $this->getView()->set('Shippings', $Shipping->findList($params, 'Position asc'));
     return $this->getView()->render();
 }
コード例 #3
0
 public function testCollectDoesNotCalculateTaxIfThereIsNoItemsRelatedToGivenAddress()
 {
     $storeId = 1;
     $storeMock = $this->getMockObject('Magento\\Store\\Model\\Store', ['store_id' => $storeId]);
     $quoteMock = $this->getMockObject('Magento\\Quote\\Model\\Quote', ['store' => $storeMock]);
     $addressMock = $this->getMockObject('Magento\\Quote\\Model\\Quote\\Address', ['all_items' => [], 'shipping_tax_calculation_amount' => 100, 'base_shipping_tax_calculation_amount' => 200, 'shipping_discount_amount' => 10, 'base_shipping_discount_amount' => 20, 'quote' => $quoteMock]);
     $this->taxCalculationMock->expects($this->never())->method('calculateTax');
     $this->model->collect($addressMock);
 }
コード例 #4
0
 /**
  * @test
  */
 public function xmlSerializeMustAppendShippingData()
 {
     $this->markTestSkipped();
     $xml = simplexml_load_string('<?xml version="1.0" encoding="UTF-8"?><test />');
     $address = $this->getMock('PHPSC\\PagSeguro\\Customer\\Address', [], [], '', false);
     $shipping = new Shipping(Type::TYPE_PAC, $address, '10.31');
     $address->expects($this->once())->method('xmlSerialize')->with($this->isInstanceOf('SimpleXMLElement'));
     $shipping->xmlSerialize($xml);
     $this->assertEquals(1, (string) $xml->shipping->type);
     $this->assertEquals(10.31, (string) $xml->shipping->cost);
 }
コード例 #5
0
 public function __construct()
 {
     parent::__construct();
     $this->load->library('form_validation');
     $this->load->model('shipping_code_model');
     $this->load->model('quality_testing_model');
 }
コード例 #6
0
ファイル: content.php プロジェクト: AndreyTepaykin/Platform
function Shipping_shipment_response_content($params)
{
    $user = Users::loggedInUser(true);
    // copy from shipment
    $useTemplate = Q_Request::uri()->template ? "Shipping/shipment/" . Q_Request::uri()->template : false;
    // Check if stream "Shipping/shipments" exists for current user. If no -> create one.
    Shipping::shipments();
    // Check if stream "Shipping/templates" exists for current user. If no -> create one.
    Shipping::createTemplatesStream();
    // Collect streams for shipments. Relations: "describing", "scheduled", "confirmed", "shipping", "canceled", "returned"
    $shipment = Shipping::shipment();
    //$shipment->addPreloaded($userId);
    // test for UPS pickup
    //$stream = Streams::fetchOne("Shipping", "Shipping", "Shipping/shipment/Qdqpcspny");
    //$carrier = new Shipping_Carrier_UPS();
    //$carrier->pickupCreate($stream);
    //-------------------------------
    // add main style
    Q_Response::addStylesheet('css/Shipment.css');
    // set communityId
    Q_Response::setScriptData("Q.info.communityId", Users::communityId());
    Q_Response::setScriptData("Q.info.useTemplate", $useTemplate);
    Q_Response::addScript('js/shipment.js');
    Q_Response::addScript('js/date.js');
    // add jquery UI
    //Q_Response::addStylesheet('//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css');
    //Q_Response::addScript('//code.jquery.com/ui/1.11.4/jquery-ui.js');
    // add pickadate as date picker
    Q_Response::addStylesheet('js/pickadate/compressed/themes/default.css');
    Q_Response::addStylesheet('js/pickadate/compressed/themes/default.date.css');
    Q_Response::addScript('js/pickadate/compressed/picker.js');
    Q_Response::addScript('js/pickadate/compressed/picker.date.js');
    return Q::view('Shipping/content/shipment.php', compact('user', 'shipment', 'useTemplate'));
}
コード例 #7
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('shipping_subarea_model');
     $this->load->model('shipping_function_model');
     $this->load->library('form_validation');
 }
コード例 #8
0
 public function createAction()
 {
     if (isset($_POST['ajax']) && isset($_POST['getshipping'])) {
         $shippings = Shipping::model()->cache()->findAllInArray();
         AF::setJsonHeaders('json');
         Message::echoJsonSuccess(array('message' => $shippings));
     }
     $model = new CampaignShipping();
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['model']) && $_POST['model'] == 'Campship') {
         $model->fillFromArray($_POST);
         //$model->user_id_created = $this->user->user_id;
         //$model->user_id_updated = $this->user->user_id;
         //$model->updated = 'NOW():sql';
         //$model->created = 'NOW():sql';
         //$model->model_uset_id = $this->user->user_id;
         if (isset($_POST['ajax'])) {
             if ($model->save()) {
                 $link = AF::link(array('campship' => 'view'), array('campaign_id' => $model->campaign_id));
                 Message::echoJson('success', array('redirect' => $link));
             } else {
                 Message::echoJsonError(__('campship_not_created') . ' ' . $model->errors2string);
             }
             die;
         }
         $model->save();
         $this->redirect();
     }
     $this->addToPageTitle('Create Campaign Shipping');
     $this->render('create', array('model' => $model));
 }
コード例 #9
0
ファイル: content.php プロジェクト: AndreyTepaykin/Platform
function Shipping_templates_response_content($params)
{
    // Do controller stuff here. Prepare variables
    $env = Shipping::getVars();
    Q_Response::addStylesheet('css/ShipmentTemplates.css');
    Q_Response::addScript('js/date.js', "");
    return Q::view('Shipping/content/templates.php', compact('env'));
}
コード例 #10
0
ファイル: content.php プロジェクト: AndreyTepaykin/Platform
function Shipping_addresses_response_content($params)
{
    // Do controller stuff here. Prepare variables
    $env = Shipping::getVars();
    // set communityId
    Q_Response::addStylesheet('css/ShipmentAddresses.css');
    return Q::view('Shipping/content/addresses.php', compact('env'));
}
コード例 #11
0
 public function __construct()
 {
     parent::__construct();
     $this->load->library('form_validation');
     $this->load->model('shipping_company_model');
     $this->load->model('shipping_function_model');
     $this->load->model('shipping_subarea_model');
     $this->load->model('shipping_subarea_group_model');
     $this->load->model('shipping_type_model');
     $this->load->helper('shipping_helper');
 }
コード例 #12
0
ファイル: ajax.php プロジェクト: isonz/fxptpcn
function showShippingInfo()
{
    $no = isset($_POST['ship_no']) ? $_POST['ship_no'] : '';
    $name = isset($_POST['ship_name']) ? $_POST['ship_name'] : '';
    $no = substr($no, 1);
    $info = Shipping::get($name, $no);
    if (!$info) {
        ABase::toJson(1, 'showShippingInfo : No Data');
    } else {
        ABase::toJson(0, 'ok', $info);
    }
}
コード例 #13
0
ファイル: Shipping.php プロジェクト: conghua1013/yii
 public function getShippingList()
 {
     $data = Shipping::model()->findAll();
     if (empty($data)) {
         return '';
     }
     $list = array();
     foreach ($data as $row) {
         $list[$row->id] = $row->getAttributes();
     }
     return $list;
 }
コード例 #14
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('shipping_statistics_model');
     $this->load->model('shipping_code_model');
     $this->template->add_js('static/js/sorttable.js');
     $shipping_code_object = $this->shipping_code_model->fetch_all_shipping_codes();
     $shipping_codes = array();
     foreach ($shipping_code_object as $row) {
         $this->shipping_codes[] = $row->code;
     }
 }
コード例 #15
0
 public function testAfterSave()
 {
     $addressId = 1;
     $attributeCode = 'attribute_code';
     $defaultShipping = 'default Shipping address';
     $object = $this->getMockBuilder('Magento\\Framework\\Object')->disableOriginalConstructor()->setMethods(array('getDefaultShipping', 'getAddresses', 'setDefaultShipping'))->getMock();
     $address = $this->getMockBuilder('Magento\\Framework\\Object')->disableOriginalConstructor()->setMethods(array('getPostIndex', 'getId'))->getMock();
     $attribute = $this->getMockBuilder('Magento\\Eav\\Model\\Entity\\Attribute\\AbstractAttribute')->setMethods(array('__wakeup', 'getEntity', 'getAttributeCode'))->disableOriginalConstructor()->getMockForAbstractClass();
     $entity = $this->getMockBuilder('Magento\\Eav\\Model\\Entity\\AbstractEntity')->setMethods(array('saveAttribute'))->disableOriginalConstructor()->getMockForAbstractClass();
     $attribute->expects($this->once())->method('getEntity')->will($this->returnValue($entity));
     $attribute->expects($this->once())->method('getAttributeCode')->will($this->returnValue($attributeCode));
     $entity->expects($this->once())->method('saveAttribute')->with($this->logicalOr($object, $attributeCode));
     $address->expects($this->once())->method('getPostIndex')->will($this->returnValue($defaultShipping));
     $address->expects($this->once())->method('getId')->will($this->returnValue($addressId));
     $object->expects($this->once())->method('getDefaultShipping')->will($this->returnValue($defaultShipping));
     $object->expects($this->once())->method('setDefaultShipping')->with($addressId)->will($this->returnSelf());
     $object->expects($this->once())->method('getAddresses')->will($this->returnValue(array($address)));
     /** @var \Magento\Framework\Object $object */
     /** @var \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute */
     $this->testable->setAttribute($attribute);
     $this->testable->afterSave($object);
 }
コード例 #16
0
 public function __construct()
 {
     parent::__construct();
     $this->load->library('form_validation');
     $this->load->library('script');
     $this->load->model('mixture_model');
     $this->load->model('epacket_model');
     $this->load->model('user_model');
     $this->load->model('product_model');
     $this->load->model('order_shipping_record_model');
     $this->load->model('shipping_code_model');
     $this->load->helper('shipping_helper');
     $this->load->model('shipping_code_model');
 }
コード例 #17
0
ファイル: USPS.php プロジェクト: helpdeskskol/ci-shipping
 function getRate()
 {
     if (!$this->packages) {
         $this->error("No packages added");
         return;
     }
     $map = $this->_getRateMap();
     $xml = '<RateV3Request USERID="' . $this->userID . '" PASSWORD="">';
     foreach ($this->packages as $package => $data) {
         $xml .= '<Package ID="' . $package . '">';
         foreach ($map as $node => $field) {
             if (array_key_exists($field, $data)) {
                 $value = $data[$field];
                 $xml .= '<' . $node . '>' . $value . '</' . $node . '>';
             }
         }
         $xml .= '</Package>';
     }
     $xml .= '</RateV3Request>';
     $request = 'API=RateV3&XML=' . $xml;
     $response = parent::send($this->server, $request);
     // Check For Connection Error
     if (isset($response['ERROR'])) {
         $this->_responseError($response);
         return;
     }
     $response = $response['RATEV3RESPONSE'][0]['PACKAGE'];
     $retval = array();
     $x = 0;
     foreach ($response as $package) {
         // Check For Error
         if (isset($package['ERROR'])) {
             $this->_responseError($package);
             continue;
         }
         foreach ($package['POSTAGE'] as $rate) {
             $retval[$x][$rate['MAILSERVICE'][0]['VALUE']]['rate'] = $rate['RATE'][0]['VALUE'];
             $retval[$x][$rate['MAILSERVICE'][0]['VALUE']]['commitmentDate'] = isset($rate['COMMITMENTDATE']) ? $rate['COMMITMENTDATE'][0]['VALUE'] : '';
         }
         $x++;
     }
     if (count($retval) == 1) {
         $retval = $retval[0];
     }
     return $retval;
 }
コード例 #18
0
 public function actionDel()
 {
     $res = array('statusCode' => 200, 'message' => '删除成功!');
     try {
         if (empty($_REQUEST['id'])) {
             throw new Exception("数据错误,id不能为空!", 1);
         }
         $flag = Shipping::model()->deleteByPk($_REQUEST['id']);
         if (!$flag) {
             throw new exception('删除失败');
         }
     } catch (Exception $e) {
         $res['statusCode'] = 300;
         $res['message'] = '删除失败【' . $e->getMessage() . '】';
     }
     $res['callbackType'] = 'reloadTab';
     $res['forwardUrl'] = '/manage/shipping/index';
     $this->ajaxDwzReturn($res);
 }
コード例 #19
0
ファイル: post.php プロジェクト: AndreyTepaykin/Platform
function Shipping_tracking_post()
{
    if (empty($_REQUEST["streamName"])) {
        throw new Q_Exception_WrongValue(array('field' => 'streamName', 'range' => "not empty"));
    }
    $env = Shipping::getVars();
    $publisherId = $env->communityId;
    $stream = Streams::fetchOne($publisherId, $publisherId, "Shipping/shipment/" . $_REQUEST["streamName"]);
    // trying to send request
    $carrier = new Shipping_Carrier_TNT();
    //Q_Response::setSlot('tracking', $carrier->track($stream));
    echo $carrier->track($stream);
    exit;
    // set shipment scheduled
    //Shipping::updateShipment($shipmentStream, 'scheduled');
    //Q_Request::requireFields(array('streamName'), $_REQUEST, true);
    //$params = Q::take($_REQUEST, array("streamName"));
    //$stream = Streams::fetchOne($userId, $userId, $params["streamName"]);
    //Shipping::updateShipment($stream, "scheduled");
}
コード例 #20
0
 /**
  * Run the widget. Renders the shipping estimator lines on the page.
  */
 public function run()
 {
     // Required assets.
     $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets', false, -1, true);
     Yii::app()->clientScript->registerScriptFile($assets . '/js/WsShippingEstimator.js');
     $pathToZippo = Yii::getPathOfAlias('ext') . DIRECTORY_SEPARATOR . 'wsadvcheckout' . DIRECTORY_SEPARATOR . 'assets';
     $assets = Yii::app()->getAssetManager()->publish($pathToZippo, false, -1, true);
     Yii::app()->clientScript->registerScriptFile($assets . '/zippo.js');
     $checkoutForm = MultiCheckoutForm::loadFromSessionOrNew();
     // We may wish to update the shipping options right away if we know the
     // cart has changed.
     $updateOnLoad = false;
     if ($this->updateShippingOptions) {
         // This check for shippingCountry being null is a workaround to fix
         // WS-3180. When shippingCountry is null, we need to update the
         // shipping estimates *now* because they will not be updated by the
         // JavaScript (since the JavaScript in WsShippingEstimator requires
         // country to be set). The reason we need to do this is because
         // shippingCountry may be null when in-store pickup has been
         // chosen.
         // TODO: Fix this in WsShippingEstimator and remove this workaround.
         if (empty($checkoutForm->shippingCountry) || empty($checkoutForm->shippingPostal)) {
             Shipping::updateCartScenariosInSession();
         } else {
             $updateOnLoad = true;
         }
     }
     // Use the shipping scenarios and shipping address in the session.
     $arrCartScenario = Shipping::loadCartScenariosFromSession();
     $wsShippingEstimatorOptions = self::getShippingEstimatorOptions($arrCartScenario, $checkoutForm->shippingProvider, $checkoutForm->shippingPriority, $checkoutForm->shippingCity, $checkoutForm->shippingStateCode, $checkoutForm->shippingCountryCode, $updateOnLoad);
     $selectedCartScenario = Shipping::getSelectedCartScenarioFromSession();
     if ($selectedCartScenario !== null) {
         $formattedShippingPrice = $selectedCartScenario['formattedShippingPrice'];
         $formattedCartTax = $selectedCartScenario['formattedCartTax'];
     } else {
         $formattedShippingPrice = null;
         $formattedCartTax = null;
     }
     $this->render('_shippingestimator', array('countries' => CHtml::listData(Country::getShippingCountries(), 'code', 'country'), 'formattedShippingPrice' => $formattedShippingPrice, 'formattedCartTax' => $formattedCartTax, 'shippingCountryCode' => $wsShippingEstimatorOptions['shippingCountryCode'], 'shippingCountryName' => $wsShippingEstimatorOptions['shippingCountryName'], 'shippingPostal' => $checkoutForm->shippingPostal, 'wsShippingEstimatorOptions' => CJSON::encode($wsShippingEstimatorOptions), 'cssClass' => self::CSS_CLASS));
 }
コード例 #21
0
 function viewAction()
 {
     $this->filter();
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params));
     $models = AFActiveDataProvider::models('CampaignProduct', $this->params, $pagination);
     $dataProvider = $models->getAll();
     $camprodModel = new CampaignProduct();
     $camprodModel->campaign_id = AF::get($this->params, 'campaign_id', 0);
     $productsUpsellsMain = $camprodModel->getUpsellProducts();
     //eg: Array ( [321] => Array ( [product_id] => 321 [yes_upsell_id] => 0 ) )
     //fb($productsUpsellsMain);
     $arr = array();
     foreach ($productsUpsellsMain as $upsellArray) {
         $arr[] = $upsellArray['yes_upsell_id'];
     }
     // $arr[0] = 0
     //$upsellModel = new Upsell();
     $productsUpsells = array();
     while (!empty($arr)) {
         $upsels = Upsells::getUpsellByArrayIDs($arr);
         $arr = array();
         foreach ($upsels as $item) {
             $productsUpsells[$item['upsell_id']] = $item;
             if ($item['yes_upsell_id'] && !isset($productsUpsells[$item['yes_upsell_id']])) {
                 $arr[] = $item['yes_upsell_id'];
             }
             if ($item['no_upsell_id'] && !isset($productsUpsells[$item['no_upsell_id']])) {
                 $arr[] = $item['no_upsell_id'];
             }
         }
     }
     $products = Product::model()->cache()->findAllInArray();
     $shippings = Shipping::model()->cache()->findAllInArray();
     Assets::js('jquery.form');
     $this->addToPageTitle('Campaigns Products');
     $this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'productsUpsells' => $productsUpsells, 'productsUpsellsMain' => $productsUpsellsMain, 'products' => $products, 'shippings' => $shippings, 'campaign_id' => AF::get($this->params, 'campaign_id')));
 }
コード例 #22
0
ファイル: post.php プロジェクト: AndreyTepaykin/Platform
function Shipping_invoice_post()
{
    if (!isset($_REQUEST["field"]) && empty($_REQUEST["field"])) {
        throw new exception("Field didn't specified!");
    }
    if (!isset($_REQUEST["attr"])) {
        throw new exception("Attribute didn't specified!");
    }
    if (!isset($_REQUEST["value"])) {
        throw new exception("Value didn't specified!");
    }
    if (!isset($_REQUEST["streamName"]) || empty($_REQUEST["streamName"])) {
        throw new exception("Stream name didn't specified!");
    }
    $env = Shipping::getVars();
    $stream = Streams::fetchOne($env->communityId, $env->communityId, $_REQUEST["streamName"]);
    $field = json_decode($stream->{$_REQUEST}["field"]);
    if (!is_object($field)) {
        throw new exception("field not an object!");
    }
    $field->{$_REQUEST}["attr"] = $_REQUEST["value"];
    $stream->{$_REQUEST}["field"] = json_encode($field);
    $stream->save();
}
コード例 #23
0
 /**
  * Update the cart shipping (xlsws_cart_shipping) based on selected
  * shipping scenario from the session. Before calling this make sure that
  * the shipping scenarios in the session are up to date and the
  * checkoutForm in the session uses the desired providerId and
  * priorityLabel.
  *
  * If no cart shipping already exists, one will be created.
  * If an error occurs it will be added to $this->errors in the Yii's model error format.
  * @See CModel::getErrors().
  *
  * @return bool true if the shipping was updated, false otherwise.
  */
 public function updateShipping()
 {
     $selectedCartScenario = Shipping::getSelectedCartScenarioFromSession();
     if ($selectedCartScenario === null) {
         Yii::log('Cannot update shipping, no scenario selected', 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         return false;
     }
     Yii::log("Shipping Product " . $selectedCartScenario['shippingProduct'], 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
     // Populate the shipping object with default data.
     $this->shipping_method = $selectedCartScenario['shippingProduct'];
     $this->shipping_module = $selectedCartScenario['module'];
     $this->shipping_data = $selectedCartScenario['shippingLabel'];
     $this->shipping_cost = $selectedCartScenario['shippingPrice'];
     $this->shipping_sell = $selectedCartScenario['shippingPrice'];
     $this->shipping_sell_taxed = $selectedCartScenario['shippingPriceWithTax'];
     $this->shipping_taxable = Yii::app()->params['SHIPPING_TAXABLE'] == '1' ? 1 : 0;
     if ($this->save() === false) {
         Yii::log("Error saving Cart Shipping:\n" . print_r($this->getErrors()), 'error', 'application.' . __CLASS__ . '.' . __FUNCTION__ . '.' . __LINE__);
         return false;
     }
     Yii::app()->shoppingcart->shipping_id = $this->id;
     Yii::app()->shoppingcart->recalculateAndSave();
     return true;
 }
コード例 #24
0
ファイル: preview.php プロジェクト: romackdnr/dnrpiggyments
include "../../../classes/Database.php";
include "../../../classes/Connection.php";
include_once "../../../includes/bootstrap.php";
include "../../../classes/Cart.php";
include "../../../classes/Products.php";
include "../../../classes/Client.php";
include "../../../classes/Coupon.php";
include "../../../classes/Shipping.php";
include "../../../classes/Billing.php";
include "../../../classes/ShippingRate.php";
include "../../../classes/AdminAction.php";
include "../../../includes/security.funcs.inc";
include_once "../../../includes/Pagination.php";
$myCart = Cart::findCartByOrderID($_REQUEST['id']);
$clients = Client::findClient($myCart->fldCartClientID);
$shipping = Shipping::findShippingClient($clients->fldClientID);
$shippingRate = ShippingRate::findShippingRateByOrderCode($_REQUEST['id']);
$billing = Billing::findBillingClient($clients->fldClientID);
?>
<!DOCTYPE html>  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">  
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
  <link rel="stylesheet" type="text/css" media="screen" href="<?php 
echo $ROOT_URL;
?>
_admin/_assets/css/core3.css" /> 
  <link rel="stylesheet" type="text/css" media="screen" href="<?php 
echo $ROOT_URL;
?>
コード例 #25
0
		$shipping = Shipping::findShippingClient($client_id);
	} else {
		header("Location: index.php");
	}
		
?>
<? 
	if(isset($_POST['submit_ship'])) {
		//update the member information
		$_POST = sanitize($_POST);
		$shipping = $_POST;
		settype($shipping,'object');
		if($_POST['Id']=="") {			
			$shipping = Shipping::addShipping($shipping); 
		} else {
			$shipping = Shipping::updateShipping($shipping); 
		}
				
		
		if(isset($_SESSION['FreeShipping'])) {				
				$links = $ROOT_URL.'order-confirmation.html';
				header("Location: $links");
		} else {
		 		$links = $ROOT_URL . 'shipping-rate.html';
				header("Location: $links");
		}
		
	}
?>

コード例 #26
0
<?php

$cartScenario = Shipping::getSelectedCartScenarioFromSessionOrShoppingCart();
// The calling code has the option of providing a differently configured
// _promocodeinput. Here is a sensible default.
if (isset($partialPromoCodeInput) === false) {
    $partialPromoCodeInput = $this->renderPartial('ext.wscartmodal.views._promocodeinput', array('modelId' => 'Checkout', 'updateCartTotals' => true, 'reloadPageOnSuccess' => false), true);
}
?>

<div class="summary">
	<?php 
if (Yii::app()->user->hasFlash('taxModeChange')) {
    ?>
		<div class="pricechange">
			<?php 
    echo Yii::app()->user->getFlash('taxModeChange');
    ?>
		</div>
	<?php 
}
?>
	<h2><?php 
echo Yii::t('checkout', "Order Summary");
?>
</h2>
	<table>
		<tbody>
		<tr>
			<th><?php 
echo Yii::t('checkout', "Subtotal");
コード例 #27
0
ファイル: Order.php プロジェクト: VinceOmega/mcb-nov-build
 public function shipping()
 {
     if (isset($this->amount->shipping)) {
         return $this->amount->shipping;
     } elseif (isset($this->order->shipping)) {
         if (isset($this->order->shipping->method)) {
             $shipping = new Shipping('UPS', $this->order->shipping->zip, $this->order->shipping->country, $this->order->basket);
             $shipping->setMethod($this->order->shipping->method);
             if (!is_numeric($amount = $shipping->amount())) {
                 $this->error = $amount;
                 return 0;
             }
             if (isset($this->amount->discount['shippingDiscount'])) {
                 $amount = $amount - $amount * 0.01 * $this->amount->discount['shippingDiscount'];
             }
             //add 35% to the shipping cost that UPS returns
             $shipping_cost = $amount + 0.35 * $amount;
             $this->amount->shipping = $shipping_cost;
             return $shipping_cost;
         } else {
             return 0;
         }
     } else {
         return 0;
     }
 }
コード例 #28
0
 public function actionThank()
 {
     $user_id = Yii::app()->user->id;
     //check the billing / shipping values coresponding to this user
     $chkBillExist = Billing::model()->find('user_id = :user_id', array(':user_id' => $user_id));
     //echo "<pre>";
     //print_r($chkBillExist);
     if (empty($chkBillExist)) {
         //redirect back to checkout page
         Yii::app()->user->setFlash('showMsg', 'Your billing details are empty.');
         $this->redirect(array('shoppingCart/checkout'));
     }
     $chkShipExist = Shipping::model()->find('user_id = :user_id', array(':user_id' => $user_id));
     if (empty($chkShipExist)) {
         Yii::app()->user->setFlash('showMsg', 'Please fill your shipping details.');
         $this->redirect(array('shoppingCart/checkout'));
     }
     //end
     $model = new Reward();
     $orderModel = new Order();
     //check the session exist
     //check billing/ shipping session exist
     //finally placed the order
     //insert the cart in order table
     if (count($_SESSION['items']) > 0) {
         //get billing/shipping ids of login user
         $chkBillExist = Billing::model()->find('user_id = :user_id', array(':user_id' => $user_id));
         if (empty($chkBillExist)) {
         } else {
             $billAddId = $chkBillExist['id'];
         }
         //get shipping ids of login user
         $chkShipExist = Shipping::model()->find('user_id = :user_id', array(':user_id' => $user_id));
         if (empty($chkShipExist)) {
         } else {
             $shipAddId = $chkShipExist['id'];
         }
         $insertOrders = Yii::app()->db->createCommand()->insert('shop_order', array('user_id' => $user_id, 'shipping_address_id' => $billAddId, 'billing_address_id' => $shipAddId, 'ordering_done' => 1, 'grandtotal' => $_SESSION['grandTotalFinal']));
         $order_id = Yii::app()->db->getLastInsertID();
         foreach ($_SESSION['items'] as $key => $data) {
             //insert into order detail table
             $insertOrders = Yii::app()->db->createCommand()->insert('shop_order_detail', array('order_id' => $order_id, 'reward_id' => $data['id'], 'quantity' => $data['quantity']));
             $productRewardId = $data['id'];
             //get the existing quantity from db and add the posted quanity in it
             $getQuantity = "SELECT instock from reward where id = {$productRewardId}";
             $getQtyValue = Yii::app()->db->createCommand($getQuantity)->queryRow();
             $finalQuantity = $getQtyValue['instock'] - $data['quantity'];
             //update the quantity of each product shop by user
             $getResult = Yii::app()->db->createCommand()->update('reward', array('instock' => $finalQuantity), 'id=' . $data['id']);
         }
         //send email to admin and user
         $this->sendEmailToAll($order_id, $user_id);
         //end
         if (isset($_SESSION['items'])) {
             unset($_SESSION['items']);
             unset($_SESSION['grandTotalFinal']);
         }
     } else {
         Yii::app()->user->setFlash('showMsg', 'Shopping cart is empty.');
         $this->redirect(array('shoppingCart/view'));
     }
     //echo  Yii::app()->db->lastInsertID;
     //echo "----";
     //echo $last_id = Yii::app()->db->getLastInsertID();
     $this->render('thank', array('model' => $orderModel));
 }
コード例 #29
0
 /**
  * get or create attribute data for given object
  *
  * @param Shipping $object
  * @return \Shopware\Models\Attribute\CustomerShipping
  * @throws Exception 
  */
 public function getOrCreateShippingAttribute($object)
 {
     if ($attribute = $object->getAttribute()) {
         return $attribute;
     }
     if ($object instanceof Shopware\Models\Customer\Shipping) {
         if (!($attribute = Shopware()->Models()->getRepository('Shopware\\Models\\Attribute\\CustomerShipping')->findOneBy(array('customerShippingId' => $object->getId())))) {
             $attribute = new Shopware\Models\Attribute\CustomerShipping();
         }
     } else {
         throw new Exception('Unknown attribute base class');
     }
     $object->setAttribute($attribute);
     return $attribute;
 }
コード例 #30
0
ファイル: content.php プロジェクト: AndreyTepaykin/Platform
function Shipping_history_response_content($params)
{
    // Do controller stuff here. Prepare variables
    // get "Shipping/shipments" stream
    $env = Shipping::getVars();
    Q_Response::addStylesheet('css/ShipmentHistory.css');
    Q_Response::addStylesheet('css/jquery.dropdown.css');
    Q_Response::addScript('js/jquery.dropdown.js');
    // run only once
    Q_Response::addScript('js/scheduled.js', "");
    Q_Response::addScript('js/date.js', "");
    // very first defaultState
    $defaultState = "pickup";
    $shippingStates = array();
    // get states from config
    $tmp = Q_Config::expect('Shipping', 'states');
    foreach ($tmp as $shippingState) {
        // set default state
        if (isset($shippingState["default"]) && $shippingState["default"]) {
            $defaultState = $shippingState["type"];
        }
        $shippingStates[$shippingState["type"]] = $shippingState["title"];
    }
    // state from REQUEST have high priority, then defaultState from config
    $defaultState = isset($_REQUEST["type"]) ? $_REQUEST["type"] : $defaultState;
    // get next pickup date
    $streamsRes = Streams::related($env->communityId, $env->communityId, $env->shipmentsStreamName, true, array("type" => "pickup"));
    if (!count($streamsRes[1])) {
        $minDate = false;
    } else {
        $dateNow = new DateTime("now");
        //$minDate = new DateTime((date("Y") + 1).'-'.date("m").'-'.date("d"));
        $maxDate = $minDate = false;
        foreach ($streamsRes[1] as $stream) {
            // skip stream if collectInstructions empty
            if (empty($stream->fields["collectInstructions"])) {
                continue;
            }
            $exportDate = json_decode($stream->fields["collectInstructions"]);
            // skip stream if $exportDate not an object
            if (json_last_error() !== JSON_ERROR_NONE || !is_object($exportDate)) {
                continue;
            }
            // if exportDate or collectTimeFrom or collectTimeTo empty - continue
            if (!property_exists($exportDate, "exportDate") || !property_exists($exportDate, "collectTimeFrom") || !property_exists($exportDate, "collectTimeTo")) {
                continue;
            }
            $startDate = DateTime::createFromFormat("Y-m-d G:i", $exportDate->exportDate . ' ' . $exportDate->collectTimeFrom);
            if ($startDate > $dateNow) {
                if (!$minDate || is_a($minDate, "DateTime") && $startDate < $minDate) {
                    $minDate = $startDate;
                    $maxDate = DateTime::createFromFormat("Y-m-d G:i", $exportDate->exportDate . ' ' . $exportDate->collectTimeTo);
                }
            }
        }
        if (is_a($minDate, "DateTime") && is_a($maxDate, "DateTime")) {
            $minDate = $minDate->format("l, j M Y") . " from " . $minDate->format("ga");
            $minDate .= " to " . $maxDate->format("ga");
        } else {
            $minDate = false;
        }
    }
    // collect carriers
    $shippingCarriers = array_keys(Q_Config::expect('Shipping', 'carriers'));
    $shippingCarriers = array_combine($shippingCarriers, $shippingCarriers);
    array_unshift($shippingCarriers, 'All');
    //echo $minDate->format("l, j M Y")." from ".$minDate->format("ga")." to ".$maxDate->format("ga"); exit;
    return Q::view('Shipping/content/history.php', compact('env', 'shippingStates', 'defaultState', "minDate", "shippingCarriers"));
}