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; } }
$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);