public function displayCategories($PageID = null, $limit = 8) { $products = new Model_Products(); if (!$PageID) { $page = $this->getData("Pages", "PageType='Home'"); if ($page) { $PageID = $page[0]['ID']; } else { return array(); } } else { $page = $this->getData("Pages", "ID=" . $PageID); } if ($page) { $page_categories = explode(",", $page[0]['Categories']); } $tmp = array(); foreach ($page_categories as $category_id) { if (strlen($category_id) > 0) { $tmp[] = $products->ListProducts(null, $category_id, null, null, $limit); } } $data = array(); foreach ($tmp as $row) { foreach ($row as $k => $v) { //echo '<pre>'; print_r( $v); exit; //$this->getProductAttributes($v['ProductID']); $data[$v['CatName']][$k] = $v; } } return $data; }
public function listCartItems($items = array()) { $product = new Model_Products(); $cart_items = array(); foreach ($items as $product_id) { $cart_items[] = $product->ListProducts($product_id); } return $cart_items; }
public function productsdisplayAction() { //$this->_helper->layout()->setLayout('admin'); $products = new Model_Products(); $generic = new Model_Generic(); $categories = new Model_Categories(); $product_id = $this->_getParam('pid'); $this->view->data = $products->ListProducts($product_id); $this->view->images = $products->DisplayProductImages($product_id); $this->view->product_attributes = $products->DisplayProductAttributes($product_id); $this->view->product_categories = $products->GetProductTreeIDs($product_id); $this->view->Brands = $generic->getData("Brands"); #$this->view->Categories = $generic->getData("Category","","Name asc"); $this->view->category_tree = $categories->listCategoryTree(); $this->view->orphan_categories = $categories->listOrphanCategories(); $this->render('productscreate'); }
public function AddMemberTransaction($data, $user_details) { $transid = $data['memcheckout']; //@todo validate this //excheckout $UserID = $user_details['ID']; $Email = $user_details['SiteEmail']; $Firstname = $user_details['Firstname']; $Lastname = $user_details['Lastname']; $Phone = isset($user_details['Phone1']) ? $user_details['Phone1'] : $data['Phone1']; $ShippingAddress = isset($data['ShippingAddress']) ? $data['ShippingAddress'] : $user_details['Address'] . ' ' . $user_details['City'] . ' ' . $user_details['Country'] . ' ' . $user_details['Zip']; $PaymentMethod = $data['PaymentMethod']; //process overrieds $products = $data['Product']; $purchase = array(); $purchase_qty = array(); foreach ($products as $id => $qty) { $purchase_qty[] = $qty; } $Pricing = array_sum($purchase_qty) >= 6 ? 'WholePrice' : 'Price'; foreach ($products as $id => $qty) { $product = new Model_Products(); $product_details = $product->ListProducts($id); $purchase[] = $product_details[$Pricing] * $qty; } $Total = array_sum($purchase); //$Products = $data['Product']; $ShippingFee = $Total < 1000 ? $data['ShippingFee'] : 0; $Total = array_sum($purchase) + $ShippingFee; $Total_qty = array_sum($purchase_qty); $member_data = array('excheckout' => $transid, 'UserID' => $UserID, 'Email' => $Email, 'Firstname' => $Firstname, 'Lastname' => $Lastname, 'Phone' => $Phone, 'ShippingAddress' => $ShippingAddress, 'DropShipAddress' => $data['DropShipAddress'], 'Region' => $data['State'], 'ShippingFee' => $ShippingFee, 'PaymentMethod' => $PaymentMethod, 'Product' => $products, 'Total' => $Total, 'PaymentDue' => $data['PaymentDue'], 'SpecialInstructions' => $data['SpecialInstructions'], 'StoreCreditsUsed' => $data['StoreCreditsUsed']); $process = $this->Add($member_data, $user_details); return $process; }
public function paynowAction() { $this->_helper->layout()->setLayout('page'); $user = $this->isLoggedIn(); if (!$user) { $this->_redirect('/login/'); } $transaction_id = $this->_getParam('TransactionID') ? $this->_getParam('TransactionID') : 0; $transactions = new Model_Transaction(); if ($transaction_id) { $data = $transactions->getUserTransaction($transaction_id, $user['SiteEmail']); } else { $this->_redirect('/myorders/'); } if (!$data) { $this->_redirect('/myorders/'); } $products = new Model_Products(); $products_data = array(); foreach ($data as $row) { $products_data[$row['ProductID']] = $products->ListProducts($row['ProductID']); } //echo '<pre>'; print_r($products_data); exit; $this->view->products_data = $products_data; $payment_exists = $transactions->getData("Payments t1", "t1.TransactionID=" . $transaction_id, "", "", "Transactions t2 on t2.ID = t1.TransactionID"); if ($payment_exists) { $this->view->payment_exists = 1; $this->view->payment_data = $payment_exists; } $rawStates = $transactions->getData("Shipping", "", "State asc"); foreach ($rawStates as $row) { $states[$row['ID']] = $row['State']; } $this->view->states = $states; $this->view->payment_methods = $this->paymentMethods(); $this->view->data = $data; $this->view->transaction_id = $transaction_id; $this->view->paynow_page = 1; }
function CategoryList($name) { $products = new Model_Products(); $data = $products->ListProducts("", $name, "", ""); return $data; }