本文整理汇总了PHP中osC_Product::isTypeActionAllowed方法的典型用法代码示例。如果您正苦于以下问题:PHP osC_Product::isTypeActionAllowed方法的具体用法?PHP osC_Product::isTypeActionAllowed怎么用?PHP osC_Product::isTypeActionAllowed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osC_Product
的用法示例。
在下文中一共展示了osC_Product::isTypeActionAllowed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quote
public function quote()
{
global $osC_ShoppingCart, $osC_Weight;
$dest_country = $osC_ShoppingCart->getShippingAddress('country_iso_code_2');
$dest_zone = 0;
$error = false;
$shipping_method = null;
$shipping_cost = null;
$shipping_weight = 0;
foreach ($osC_ShoppingCart->getProducts() as $product) {
$osC_Product = new osC_Product($product['id']);
if ($osC_Product->isTypeActionAllowed('apply_shipping_fees')) {
$shipping_weight += $osC_Weight->convert($product['weight'], SHIPPING_WEIGHT_UNIT, MODULE_SHIPPING_ZONES_WEIGHT_UNIT) * $product['quantity'];
}
}
for ($i = 1; $i <= $this->num_zones; $i++) {
$countries_table = constant('MODULE_SHIPPING_ZONES_COUNTRIES_' . $i);
$country_zones = preg_split("/[,]/", $countries_table);
if (in_array($dest_country, $country_zones)) {
$dest_zone = $i;
break;
}
}
if ($dest_zone == 0) {
$error = true;
} else {
$shipping = -1;
$zones_cost = constant('MODULE_SHIPPING_ZONES_COST_' . $dest_zone);
$zones_table = preg_split("/[:,]/", $zones_cost);
$size = sizeof($zones_table);
for ($i = 0; $i < $size; $i += 2) {
if ($shipping_weight <= $zones_table[$i]) {
$shipping = $zones_table[$i + 1];
$shipping_method = __('shipping_zones_method') . ' ' . $dest_country . ' : ' . $osC_Weight->display($osC_ShoppingCart->getWeight(), MODULE_SHIPPING_ZONES_WEIGHT_UNIT);
break;
}
}
if ($shipping == -1) {
$shipping_cost = 0;
$shipping_method = __('shipping_zones_undefined_rate');
} else {
$shipping_cost = $shipping * $osC_ShoppingCart->numberOfShippingBoxes() + constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone);
}
}
$this->quotes = array('id' => $this->_code, 'module' => $this->_title, 'methods' => array(array('id' => $this->_code, 'title' => $shipping_method, 'cost' => $shipping_cost)), 'tax_class_id' => $this->tax_class);
if (!empty($this->icon)) {
$this->quotes['icon'] = osc_image($this->icon, $this->_title);
}
if ($error == true) {
$this->quotes['error'] = __('shipping_zones_invalid_zone');
}
return $this->quotes;
}
示例2: quote
public function quote()
{
global $osC_ShoppingCart;
$number_of_items = 0;
foreach ($osC_ShoppingCart->getProducts() as $product) {
$osC_Product = new osC_Product($product['id']);
if ($osC_Product->isTypeActionAllowed('apply_shipping_fees')) {
$number_of_items += $product['quantity'];
}
}
$this->quotes = array('id' => $this->_code, 'module' => $this->_title, 'methods' => array(array('id' => $this->_code, 'title' => __('shipping_item_method'), 'cost' => MODULE_SHIPPING_ITEM_COST * $number_of_items + MODULE_SHIPPING_ITEM_HANDLING)), 'tax_class_id' => $this->tax_class);
if (!empty($this->icon)) {
$this->quotes['icon'] = osc_image($this->icon, $this->_title);
}
return $this->quotes;
}
示例3: quote
public function quote()
{
global $osC_ShoppingCart;
$this->_setMachinable('False');
$this->_setContainer('None');
$this->_setSize('REGULAR');
// usps doesnt accept zero weight
$shipping_weight = 0.1;
foreach ($osC_ShoppingCart->getProducts() as $product) {
$osC_Product = new osC_Product($product['id']);
if ($osC_Product->isTypeActionAllowed('apply_shipping_fees')) {
$shipping_weight += $product['weight'] * $product['quantity'];
}
}
$shipping_pounds = floor($shipping_weight);
$shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight)));
$this->_setWeight($shipping_pounds, $shipping_ounces);
$uspsQuote = $this->_getQuote();
if (is_array($uspsQuote)) {
if (isset($uspsQuote['error'])) {
$this->quotes = array('module' => $this->_title, 'error' => $uspsQuote['error']);
} else {
$this->quotes = array('id' => $this->_code, 'module' => $this->_title . ' (' . $osC_ShoppingCart->numberOfShippingBoxes() . ' x ' . ($osC_ShoppingCart->getShippingBoxesWeight() < 0.1 ? 0.1 : $osC_ShoppingCart->getShippingBoxesWeight()) . 'lbs)', 'tax_class_id' => $this->tax_class);
$methods = array();
$size = sizeof($uspsQuote);
for ($i = 0; $i < $size; $i++) {
list($type, $cost) = each($uspsQuote[$i]);
$methods[] = array('id' => $type, 'title' => isset($this->types[$type]) ? $this->types[$type] : $type, 'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $osC_ShoppingCart->numberOfShippingBoxes());
}
$this->quotes['methods'] = $methods;
}
} else {
$this->quotes = array('module' => $this->_title, 'error' => __('shipping_usps_error'));
}
if (!empty($this->icon)) {
$this->quotes['icon'] = osc_image($this->icon, $this->_title);
}
return $this->quotes;
}
示例4: quote
public function quote()
{
global $osC_Currencies, $osC_Tax, $osC_ShoppingCart, $osC_Weight;
$order_total = 0;
if (MODULE_SHIPPING_TABLE_MODE == 'price') {
foreach ($osC_ShoppingCart->getProducts() as $product) {
$osC_Product = new osC_Product($product['id']);
if ($osC_Product->isTypeActionAllowed('apply_shipping_fees')) {
$tax = $osC_Tax->getTaxRate($product['tax_class_id'], $osC_ShoppingCart->getTaxingAddress('country_id'), $osC_ShoppingCart->getTaxingAddress('zone_id'));
$order_total += $osC_Currencies->addTaxRateToPrice($product['price'], $tax, $product['quantity']);
}
}
} else {
foreach ($osC_ShoppingCart->getProducts() as $product) {
$osC_Product = new osC_Product($product['id']);
if ($osC_Product->isTypeActionAllowed('apply_shipping_fees')) {
$order_total += $osC_Weight->convert($product['weight'], $product['weight_class_id'], MODULE_SHIPPING_TABLE_WEIGHT_UNIT) * $product['quantity'];
}
}
}
$table_cost = preg_split("/[:,]/", MODULE_SHIPPING_TABLE_COST);
$size = sizeof($table_cost);
for ($i = 0, $n = $size; $i < $n; $i += 2) {
if ($order_total <= $table_cost[$i]) {
$shipping = $table_cost[$i + 1];
break;
}
}
if (MODULE_SHIPPING_TABLE_MODE == 'weight') {
$shipping = $shipping * $osC_ShoppingCart->numberOfShippingBoxes();
}
$this->quotes = array('id' => $this->_code, 'module' => $this->_title, 'methods' => array(array('id' => $this->_code, 'title' => __('shipping_table_method'), 'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)), 'tax_class_id' => $this->tax_class);
if (!empty($this->icon)) {
$this->quotes['icon'] = osc_image($this->icon, $this->_title);
}
return $this->quotes;
}