本文整理汇总了PHP中mslib_fe::loadShippingMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP mslib_fe::loadShippingMethod方法的具体用法?PHP mslib_fe::loadShippingMethod怎么用?PHP mslib_fe::loadShippingMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mslib_fe
的用法示例。
在下文中一共展示了mslib_fe::loadShippingMethod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProductMappedMethods
public function getProductMappedMethods($pids = array(), $type = '', $user_country = '0')
{
//hook to let other plugins further manipulate the settings
$collecting_active_method = false;
$active_methods_data = array();
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['getProductMappedMethodsPreProc'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['getProductMappedMethodsPreProc'] as $funcRef) {
$params = array('pids' => &$pids, 'type' => &$type, 'user_country' => &$user_country, 'collecting_active_method' => &$collecting_active_method);
\TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
}
}
if (is_array($pids) and count($pids)) {
switch ($type) {
case 'payment':
// first we load all options
$allmethods = mslib_fe::loadPaymentMethods(0, $user_country, true, true);
$count_a = count($allmethods);
$count_b = 0;
$count_c = 0;
foreach ($pids as $pid) {
$str = $GLOBALS['TYPO3_DB']->SELECTquery('s.code, pmm.negate', 'tx_multishop_products_method_mappings pmm, tx_multishop_payment_methods s', 's.status=1 and pmm.type=\'' . $type . '\' and pmm.products_id = \'' . $pid . '\' and pmm.method_id=s.id', '', '', '');
$qry = $GLOBALS['TYPO3_DB']->sql_query($str);
$array = array();
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) {
if (!isset($allmethods[$row['code']])) {
if (!$row['negate']) {
$allmethods[$row['code']] = mslib_fe::loadPaymentMethod($row['code']);
if ($collecting_active_method) {
$active_methods_data[$type][$row['code']] = $allmethods[$row['code']];
}
$count_c++;
}
} else {
if ($row['negate'] > 0) {
unset($allmethods[$row['code']]);
$count_b++;
} else {
if ($collecting_active_method) {
$active_methods_data[$type][$row['code']] = $allmethods[$row['code']];
}
}
}
}
}
//$count_b=count($allmethods);
if ($count_a == $count_b || !$count_b && !$count_c) {
$allmethods = array();
}
break;
case 'shipping':
// first we load all options
$allmethods = mslib_fe::loadShippingMethods(0, $user_country, true, true);
$count_a = count($allmethods);
$count_b = 0;
$count_c = 0;
foreach ($pids as $pid) {
$str = $GLOBALS['TYPO3_DB']->SELECTquery('s.*, d.description, d.name, pmm.negate', 'tx_multishop_products_method_mappings pmm, tx_multishop_shipping_methods s, tx_multishop_shipping_methods_description d', 's.status=1 and pmm.type=\'' . $type . '\' and pmm.products_id = \'' . $pid . '\' and pmm.method_id=s.id and d.language_id=\'' . $this->sys_language_uid . '\' and s.id=d.id', '', 's.sort_order', '');
$qry = $GLOBALS['TYPO3_DB']->sql_query($str);
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) {
if (!isset($allmethods[$row['code']])) {
if (!$row['negate']) {
$allmethods[$row['code']] = mslib_fe::loadShippingMethod($row['code']);
if ($collecting_active_method) {
$active_methods_data[$type][$row['code']] = $allmethods[$row['code']];
}
$count_c++;
}
} else {
if ($row['negate'] > 0) {
unset($allmethods[$row['code']]);
$count_b++;
} else {
if ($collecting_active_method) {
$active_methods_data[$type][$row['code']] = $allmethods[$row['code']];
}
}
}
}
}
//$count_b=count($allmethods);
if ($count_a == $count_b || !$count_b && !$count_c) {
$allmethods = array();
}
break;
}
//hook to let other plugins further manipulate the settings
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['getProductMappedMethodsPostProc'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['getProductMappedMethodsPostProc'] as $funcRef) {
$params = array('pids' => &$pids, 'type' => &$type, 'user_country' => &$user_country, 'allmethods' => &$allmethods, 'active_methods_data' => &$active_methods_data, 'collecting_active_method' => &$collecting_active_method);
\TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
}
}
return $allmethods;
}
}
示例2: str_replace
$tmpcontent .= 1;
} else {
if ($method_mappings['payment']['method_data'][$payment_method['id']]['negate'] > 0) {
$tmpcontent .= 0;
} else {
$tmpcontent .= '';
}
}
}
} else {
if (strpos($field, 'product_shipping_methods_') !== false) {
if ($row['products_id']) {
$method_mappings = mslib_befe::getMethodsByProduct($row['products_id']);
}
$shipping_code = str_replace('product_shipping_methods_', '', $field);
$shipping_method = mslib_fe::loadShippingMethod($shipping_code);
if (is_array($method_mappings['shipping']) && in_array($shipping_method['id'], $method_mappings['shipping'])) {
if (!$method_mappings['shipping']['method_data'][$shipping_method['id']]['negate']) {
$tmpcontent .= 1;
} else {
if ($method_mappings['shipping']['method_data'][$shipping_method['id']]['negate'] > 0) {
$tmpcontent .= 0;
} else {
$tmpcontent .= '';
}
}
}
} else {
if (strpos($field, 'shipping_costs_per_product_zone_') !== false) {
$zone_cn_id = str_replace('shipping_costs_per_product_zone_', '', $field);
list($zone_id, $cn_iso_nr) = explode('_', $zone_cn_id);