} $options_tab_virtual_product .= '</div></div> <div class="form-group toggle_advanced_option" id="msEditProductInputVirtualProductExternalUrl_' . $language['uid'] . '"> <label for="file_remote_location" class="col-md-2 control-label">' . $this->pi_getLL('admin_external_url') . '</label> <div class="col-md-10"> <input type="text" class="form-control text" name="file_remote_location[' . $language['uid'] . ']" id="file_remote_location[' . $language['uid'] . ']" value="' . htmlspecialchars($lngproduct[$language['uid']]['file_remote_location']) . '"> </div> </div>'; $options_tab_virtual_product .= '</div></div></div>'; } } $shipping_payment_method = ''; if ($this->ms['MODULES']['PRODUCT_EDIT_METHOD_FILTER']) { $payment_methods = mslib_fe::loadPaymentMethods(); // loading shipping methods eof $shipping_methods = mslib_fe::loadShippingMethods(); if (count($payment_methods) or count($shipping_methods)) { // the value is are the negate value // negate 1 mean the shipping/payment are excluded $shipping_payment_method .= ' <div class="form-group div_products_mappings toggle_advanced_option" id="msEditProductInputPaymentMethod"> <label class="control-label col-md-2">' . $this->pi_getLL('admin_mapped_methods') . '</label> <div class="col-md-10"> <div class="innerbox_methods"> <div class="innerbox_payment_methods"> <p class="form-control-static"><strong>' . $this->pi_getLL('admin_payment_methods') . '</strong></p> '; // load mapped ids $method_mappings = array(); if ($product['products_id']) { $method_mappings = mslib_befe::getMethodsByProduct($product['products_id']);
$return_data = array(); $country_cn_iso_nr = $this->post['tx_multishop_pi1']['country_id']; // //$cart=$GLOBALS['TSFE']->fe_user->getKey('ses', $this->cart_page_uid); require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'pi1/classes/class.tx_mslib_cart.php'; $mslib_cart = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_mslib_cart'); $mslib_cart->init($this); $cart = $mslib_cart->getCart(); $products = $cart['products']; $pids = array(); foreach ($products as $product) { $pids[] = $product['products_id']; } $product_mappings = mslib_fe::getProductMappedMethods($pids, 'shipping', $country_cn_iso_nr); // $shipping_methods = mslib_fe::loadShippingMethods(0, $country_cn_iso_nr, true, true); if (!count($product_mappings)) { $product_mappings = $shipping_methods; } $return_data['shipping_methods'] = array(); foreach ($shipping_methods as $shipping_method) { if (isset($product_mappings[$shipping_method['code']])) { $return_data['shipping_methods'][] = $shipping_method; } } echo json_encode($return_data); exit; break; case 'get_shoppingcart_shippingcost_overview': if ($this->ms['MODULES']['FORCE_CHECKOUT_SHOW_PRICES_INCLUDING_VAT'] == '1') { $this->ms['MODULES']['SHOW_PRICES_INCLUDING_VAT'] = 1;
if (!count($shipping_methods)) { $shipping_methods = $shipping_methods_group; } } } break; } } if (!count($payment_methods)) { // nothing is loaded. this cant be valid so let's load the default methods. // loading payment methods $payment_methods = mslib_fe::loadPaymentMethods(0, $user_country, true, true); } if (!count($shipping_methods)) { // loading shipping methods eof $shipping_methods = mslib_fe::loadShippingMethods(0, $delivery_user_country, true, true); } } if (count($shipping_methods) == 0 and count($payment_methods) == 0) { $stepCodes = array('checkout_address', 'checkout_review', 'checkout_finished'); } else { $stepCodes = array('checkout_address', 'checkout_shipping_payment_method', 'checkout_review', 'checkout_finished'); } function CheckoutStepping(&$steps, $current, $pointer) { $output = '<ul id="checkout_crumbar">'; for ($i = 0; $i < count($steps); $i++) { $output .= '<li class="' . $steps[$i] . ' ' . ($current == $steps[$i] ? 'active' : '') . '">'; if ($steps[$i] == $current) { $output .= '<strong>'; }
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; } }