public function testGetHtmlNoCustomer() { $data = ['account' => []]; $this->_context->getBackendSession()->setCustomerData($data); $this->_block = $this->_objectManager->get('Magento\\Framework\\View\\LayoutInterface')->createBlock('Magento\\Customer\\Block\\Adminhtml\\Edit\\Tab\\Carts', '', ['context' => $this->_context]); $html = $this->_block->toHtml(); $this->assertContains("<div id=\"customer_cart_grid\"", $html); $this->assertRegExp('/<div class=".*admin__data-grid-toolbar"/', $html); $this->assertContains("customer_cart_gridJsObject = new varienGrid('customer_cart_grid',", $html); $this->assertContains("backend/customer/cart_product_composite_cart/configure/key/", $html); }
/** * Get shipping total. */ function get_shipping_total($cart, $options = null) { if ($options['discount']) { // Override with stored discount value. if (is_numeric($cart['shipping_discount'])) { return $cart['shipping_discount']; } else { if ($cart['order']['id'] && is_numeric($cart['order']['shipping_discount'])) { return $cart['order']['shipping_discount']; } } } else { // Override with stored total value. if (is_numeric($cart['shipping_total'])) { return $cart['shipping_total']; } else { if ($cart['order']['id'] && is_numeric($cart['order']['shipping_total'])) { return $cart['order']['shipping_total']; } } } $method_name = $cart['order']['shipping']['method']; // Get fresh methods/prices. $methods = Carts::get_shipping_methods($cart); // Find the selected method and price. foreach ((array) $methods as $method) { if ($method['name'] == $method_name) { // Discount total? if ($options['discount']) { return $method['discount']; } $total = $method['price']; // Adjust total if applicable. return $total + $cart['shipping_fee']; } } return null; }
function modifySku() { $cart_id = get_post_value('cart_id'); $sku_id = get_post_value('sku_id'); $img_path = get_post_value('img_path'); //echo $cart_id; //echo $sku_id; //echo $img_path; $cart = new Carts(); $modifySku = $cart->modifySku($cart_id, $sku_id, $img_path); if ($modifySku) { $this->assign('message', $modifySku); $this->setReturnType('message'); } }