public function getFields() { $this->loadLanguageFile('backend/Product'); $fields['Product.ID'] = $this->translate('Product.ID'); $productController = new ProductController($this->application); foreach ($productController->getAvailableColumns(Category::getInstanceByID($this->application->getRequest()->get('category'), true), true) as $key => $data) { $fields[$key] = $this->translate($data['name']); } unset($fields['Product.reviewCount']); unset($fields['ShippingClass.name']); unset($fields['TaxClass.name']); unset($fields['hiddenType']); unset($fields['ProductImage.url']); $groupedFields = array(); foreach ($fields as $field => $fieldName) { list($class, $field) = explode('.', $field, 2); $groupedFields[$class][$class . '.' . $field] = $fieldName; } $groupedFields['Product']['Product.shippingClass'] = $this->translate('Product.shippingClass'); $groupedFields['Product']['Product.taxClass'] = $this->translate('Product.taxClass'); $groupedFields['ProductOption']['ProductOption.options'] = $this->translate('ProductOption.options'); // do not show manufacturer field in a separate group $groupedFields['Product'] = array_merge($groupedFields['Product'], $groupedFields['Manufacturer']); unset($groupedFields['Manufacturer']); // variations $groupedFields['ProductVariation']['Product.parentID'] = $this->translate('Product.parentID'); $groupedFields['ProductVariation']['Parent.parentSKU'] = $this->translate('Product.parentSKU'); for ($k = 1; $k <= 5; $k++) { $groupedFields['ProductVariation']['ProductVariation.' . $k] = $this->maketext('_variation_name', $k); } // image fields $groupedFields['ProductImage']['ProductImage.mainurl'] = $this->translate('_main_image_location'); for ($k = 1; $k <= 3; $k++) { $groupedFields['ProductImage']['ProductAdditionalImage.' . $k] = $this->maketext('_additional_image_location', $k); } $groupedFields['ProductImage']['ProductImage.Images'] = $this->translate('_images'); // category fields $groupedFields['Category']['Category.ID'] = $this->translate('Category.ID'); for ($k = 1; $k <= 10; $k++) { $groupedFields['Category']['Category.' . $k] = $this->maketext('_category_x', $k); } $groupedFields['Category']['Categories.Categories'] = $this->translate('_categories'); $groupedFields['Category']['Categories.ExtraCategories'] = $this->translate('_extra_categories'); $groupedFields['Category']['Categories.categoryIDs'] = $this->translate('_categoryIDs'); // price fields $groupedFields['ProductPrice']['ProductPrice.listPrice'] = $this->translate('_list_price'); for ($k = 1; $k <= 5; $k++) { $groupedFields['ProductPrice']['ProductPrice.' . $k] = $this->maketext('_quantity_level_x', $k); } return $groupedFields; }
public function update($id) { $rules = array('code' => 'required', 'name' => 'required', 'price' => array('required', 'regex:/^\\d*(\\.\\d{2})?$/'), 'categories' => 'required', 'product_image' => 'mimes:jpeg,bmp,png'); $validator = Validator::make(Input::all(), $rules); // process the login if ($validator->fails()) { return Redirect::to('admin/product/' . $id . '/edit')->withErrors($validator)->withInput(); } else { // store $filename = ""; if (Input::hasFile('product_image')) { if (Input::file('product_image')->isValid()) { Input::file('product_image')->move(ProductController::imagePath()); $filename = Input::file('product_image')->getClientOriginalName(); } } Product::where('code', '=', $id)->update(['code' => Input::get('code')]); Product::where('code', '=', $id)->update(['name' => Input::get('name')]); if ($filename !== "") { Product::where('code', '=', $id)->update(['image' => ProductController::imagePath() . $filename]); } Product::where('code', '=', $id)->update(['price' => Input::get('price')]); $product = Product::where('code', '=', $id)->firstOrFail(); foreach (Category::all() as $cat) { DB::table('products_category')->where('product_id', '=', $product->code)->where('category_id', '=', $cat->id)->softDeletes(); } foreach (Input::get('categories') as $catId) { DB::table('products_category')->insert(array('product_id' => $product->code, 'category_id' => $catId)); } // redirect Session::flash('message', 'Successfully updated product!'); return Redirect::to('admin/product'); } }
function __construct($config = array()) { parent::__construct($config); //product $this->registerTask('apply', 'save'); $this->registerTask('add', 'edit'); $this->registerTask('unpublish', 'publish'); }
function __construct($config = array()) { parent::__construct($config); //product $this->registerTask('apply', 'save'); $this->registerTask('add', 'edit'); $this->registerTask('unpublish', 'publish'); $this->registerTask('nofrontpage', 'frontpage'); $this->registerTask('undiscount', 'discount'); $this->registerTask('noproducts', 'hasproducts'); }
public function deleteMember($key) { $dbs = new MemberDBS(); $doc = $dbs->where('_id', $key)->orWhere('memberName', $key); if (isset($doc->get()[0])) { $data = $doc->get()[0]['Order']; for ($i = 0; $i < count($data); $i++) { $item = $data[$i]; $ProductController = new ProductController(); if (!$ProductController->deleteOrderOfProduct($item['product'], $item['Order_id'])) { return Response::json(array('message' => 'error to update the order in product list')); } } if ($doc->delete()) { return Response::json(array('message' => 'success')); } else { return Response::json(array('message' => 'error to delete member')); } } else { return Response::json(array('message' => 'Member not found')); } }
</script> </head> <body class="body" > <?php include_once 'header.php'; ?> <div id="contain" class="contain contain box-transparent"> <?php if (isset($_REQUEST['productid']) && $_REQUEST['productid'] != null) { include_once $contextPath . "controller/ProductController.php"; include_once $contextPath . "controller/CommentController.php"; include_once $contextPath . "controller/ProductImageController.php"; include_once $contextPath . "controller/UserController.php"; $productid = $_REQUEST['productid']; $product_detail = ProductController::GetProductByID($_REQUEST['productid']); $productImage = ProductImageController::GetImageOfProductFromProductID($productid); $productComment = CommentController::GetCommentFromProductID($productid); $_SESSION["addCart"] = "true"; } else { Utils::redirect("product-list.php"); } ?> <?php require_once 'left-menu.php'; ?> <div > <div class="product-detail-picture"> <div id="image_wrap" >
public function vote() { $opinionVote = self::POST('opinionVotes/filtered', array('userId' => $this->userId, 'opinionId' => $this->opinionId)); if (!empty($opinionVote)) { if ($this->upDown == $opinionVote->getUpDown()) { return; } else { $this->updateOpinionVote($opinionVote->getId()); } } else { $this->addOpinionVote(); } ProductController::updateButtonHighlight($this->opinionId, $this->upDown); }
$curPage = $curPage > 0 ? $curPage : 1; $curItem = ($curPage - 1) * $maxItems; ?> <?php include_once 'header.php'; ?> <?php require_once "../../controller//ProductController.php"; $type = $_GET['type']; $subtype = 0; if (!$_GET['subtype'] == '0') { $subtype = $_GET['subtype']; } $productList = null; $productList = ProductController::getProductsOnPage($type, $subtype, null, $curItem, $maxItems); $totalItems = ProductController::getProductsOnPageCount($type, $subtype, null); echo ' <script type="text/javascript"> var array = $("ul#nav > li"); for ( var int = 0; int < array.length; int++) { var array_element = array[int]; if ($(array_element).attr("id") == "selected") { $(array_element).attr("id", ""); } } </script>'; if ($type == '1') { echo ' <script type="text/javascript"> var array = $("ul#nav > li"); for ( var int = 0; int < array.length; int++) { $(array[2]).attr("id", "selected"); }
<th>Name</th> <th>Price</th> <th>Image</th> <th>Categories</th> <th>Actions</th> </tr> </thead> <tbody> @foreach($products as $product) <tr> <td>{{$product->code}}</td> <td>{{$product->mark()->getResults()->name}}</td> <td>{{$product->name}}</td> <td>{{$product->price}}</td> <?php $image = str_replace(ProductController::imagePath(), "", $product->image); ?> <td><img src="{{asset('/web/images/product/phpOP4Umz')}}" style="width: 50px; height: 50px;"/></td> <td> <?php $count = 0; foreach ($product->categories()->getResults() as $category) { if ($count < count($product->categories()->get()) - 1) { echo $category->name . ', '; } else { echo $category->name; } $count++; } ?> </td>
ProductController::get_products('Salaatti'); }); $routes->get('/tuotteet/:category/lisaa', 'check_logged_in', 'check_if_admin', function ($category) { ProductController::add_form($category); }); $routes->post('/tuotteet/:category/lisaa', 'check_logged_in', 'check_if_admin', function () { ProductController::add(); }); $routes->get('/tuotteet/:category/:id/muokkaa', 'check_logged_in', 'check_if_admin', function ($category, $id) { ProductController::edit_form($id); }); $routes->post('/tuotteet/:category/:id/muokkaa', 'check_logged_in', 'check_if_admin', function ($category, $id) { ProductController::edit($id); }); $routes->post('/tuotteet/:id/poista', 'check_logged_in', 'check_if_admin', function ($id) { ProductController::delete($id); }); $routes->get('/ainesosat', 'check_logged_in', 'check_if_admin', function () { IngredientController::get_ingredients(); }); $routes->get('/ainesosat/:id/muokkaa', 'check_logged_in', 'check_if_admin', function ($id) { IngredientController::edit_form($id); }); $routes->post('/ainesosat/:id/muokkaa', 'check_logged_in', 'check_if_admin', function ($id) { IngredientController::edit($id); }); $routes->get('/ainesosat/lisaa', 'check_logged_in', 'check_if_admin', function () { IngredientController::add_form(); }); $routes->post('/ainesosat/lisaa', 'check_logged_in', 'check_if_admin', function () { IngredientController::add();
private function addProductToCart($id, $prefix = '') { if ($prefix && !$this->request->get($prefix . 'count')) { return '"'; } $product = Product::getInstanceByID($id, true, array('Category')); $productRedirect = new ActionRedirectResponse('product', 'index', array('id' => $product->getID(), 'query' => 'return=' . $this->request->get('return'))); if (!$product->isAvailable()) { $productController = new ProductController($this->application); $productController->setErrorMessage($this->translate('_product_unavailable')); return $productRedirect; } $variations = !$product->parent->get() ? $product->getVariationData($this->application) : array(); ClassLoader::import('application.controller.ProductController'); $validator = ProductController::buildAddToCartValidator($product->getOptions(true)->toArray(), $variations, $prefix); if (!$validator->isValid()) { return $productRedirect; } // check if a variation needs to be added to cart instead of a parent product if ($variations) { $product = $this->getVariationFromRequest($variations); } $count = $this->request->get($prefix . 'count', 1); if ($count < $product->getMinimumQuantity()) { $count = $product->getMinimumQuantity(); } $item = $this->order->addProduct($product, $count); if ($item instanceof OrderedItem) { $item->name->set($product->name->get()); foreach ($product->getOptions(true) as $option) { $this->modifyItemOption($item, $option, $this->request, $prefix . 'option_' . $option->getID()); } if ($this->order->isMultiAddress->get()) { $item->save(); } if ($product->type->get() == Product::TYPE_RECURRING) { if ($item->isExistingRecord() == false) { $item->save(); // or save in SessionOrder::save() } $recurringID = $this->getRequest()->get('recurringID'); $recurringProductPeriod = $product->getRecurringProductPeriodById($recurringID); if ($recurringProductPeriod == null) { $recurringProductPeriod = $product->getDefaultRecurringProductPeriod(); } if ($recurringProductPeriod) { $instance = RecurringItem::getNewInstance($recurringProductPeriod, $item); $instance->save(); $item->updateBasePriceToCalculatedPrice(); } // what if product with type recurring but no plan? just ignore? } } }
public function addProductOption($id) { $valid = true; $validReal = true; $orderoptions = $optionids = array(); if (isset($_POST['OrderOption'])) { foreach ($_POST['OrderOption'] as $option) { if (is_array($option['product_option_value_id'])) { foreach ($option['product_option_value_id'] as $value_id) { $orderoption = new OrderOption(); $orderoption->attributes = $option; $orderoption->product_option_value_id = $value_id; $valid = $valid && $this->validateProductOption($orderoption); $orderoptions[] = $orderoption; $optionids[] = $orderoption->product_option_id; } } else { $orderoption = new OrderOption(); $orderoption->attributes = $option; $valid = $valid && $this->validateProductOption($orderoption); $orderoptions[] = $orderoption; $optionids[] = $orderoption->product_option_id; } } } $productC = new ProductController(); $chkoptions = $productC->loadProductOption($id); if (!empty($chkoptions)) { foreach ($chkoptions as $realoption) { if (!in_array($realoption->product_option_id, $optionids)) { $validReal = false; break; } } } $this->_orderoption = $orderoptions; return $valid && $validReal; }
array_push($_SESSION["cart"], $cartInDB[$j][2]); } } } //echo "<br>count session cart2=".count($_SESSION["cart"]); } //end check if (count($_SESSION["cart"]) > 0) { include_once $contextPath . "controller/ProductController.php"; include_once $contextPath . "controller/ProductImageController.php"; include_once $contextPath . "controller/CartController.php"; include_once $contextPath . "utility/Utils.php"; $totalmoney = 0; echo "<form action='" . $contextPath . "controller/AddCartProcessor.php' method='post' id='frmCheckOut' name='frmCheckOut'>"; for ($i = 0; $i < count($_SESSION["cart"]); $i++) { $product_detail = ProductController::GetProductByID($_SESSION["cart"][$i]); $productImage = ProductImageController::GetImageOfProductFromProductID($_SESSION["cart"][$i]); $totalmoney += $product_detail[4]; if ($i % 2 == 0) { echo "<tr style='background-color: rgb(239, 239, 239);'>"; } else { echo "<tr style='background-color: rgb(255, 255, 255);'>"; } //Image echo "<td style='border-right:solid 1px #D3D3D3; padding:4px;' width='35px' align='center'><a href='' ><img src='" . $contextPath . $productImage[1] . "'width='80px'/></a></td>"; //productID echo "<td align='center' style='border-right:solid 1px #D3D3D3; padding:4px;' width='20px'>\r\n\t\t\t\t\t\t\t <a href='product-detail.php?productid=" . $product_detail[0] . "&type=" . $product_detail[2] . "'><b style='color:blue;'>" . $product_detail[0] . "</b></a></td>"; //product Name echo "<td style='border-right:solid 1px #D3D3D3; padding:4px;'>" . $product_detail[1] . "</td>"; //Quantity if (isset($_SESSION["curUser"]) && $_SESSION["curUser"][0] > 0) {
<script type="text/javascript"> function doFilter(type) { window.location='product-list.php?type=' + type; } </script> <?php $typeList = ProductController::GetProductTypes(); $selectedSubtype = 0; if (!$_GET['type'] == '0') { $selectedSubtype = $_GET['type']; } if (isset($product_detail)) { $selectedSubtype = $product_detail['Type']; } function isSelected($selectedType1, $type1) { if ($selectedType1 == $type1) { echo 'selected'; } else { echo ''; } } ?> <div class="left-menu"> <div class="category-label"><div>Category</div></div> <div class="sub-menu"> <?php foreach ($typeList as $type) { ?> <div class="<?php isSelected($selectedSubtype, $type["ID"]);
if ($type != -1) { $strSQL .= " and Type = {$type}"; } if ($sub_type != -1) { $strSQL .= "and Sub_Type = {$sub_type} "; } if (strlen($promotion_id) > 0) { $strSQL .= "and Promotion_ID = {$promotion_id} "; } if ($present_type != -1) { $strSQL .= "and Present_Type = {$present_type} "; } if ($pricefrom > 0) { $strSQL .= "and Price >= {$pricefrom} "; } if ($priceto > 0) { $strSQL .= "and Price <= {$priceto} "; } $strSQL .= " and delete_flag = '0'"; $strSQL .= " order by priority "; $result = ProductController::GetAllBySQL($strSQL); if ($result) { echo ProductUtil::createSearchResult4Arrange($result); } } if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "arrange") { $productArr = $_REQUEST["arrProduct"]; foreach ($productArr as $key => $value) { echo ProductController::UpdatePriority($key, $value); } }
public function deleteOrder($id) { $dbs = new MemberDBS(); $rd = DB::collection($dbs->getTable())->get(); for ($i = 0; $i < count($rd); $i++) { $mem = $rd[$i]; if (array_key_exists('Order', $mem)) { $data = $mem['Order']; $found = false; $payload = array(); $product = ''; for ($j = 0; $j < count($data); $j++) { $item = $data[$j]; if ($item['Order_id'] == $id) { $found = true; $product = $item['product']; } else { array_push($payload, $item); } } if ($found) { $doc = $dbs->where('_id', $mem['_id']); if ($doc->update(array('Order' => $payload))) { $ProductController = new ProductController(); if ($ProductController->deleteOrderOfProduct($product, $id)) { return Response::json(array('message' => 'success')); } else { return Response::json(array('message' => 'error to update the order in product list')); } } else { return Response::json(array('message' => 'error to update the order in member list')); } } } } return Response::json(array('message' => 'Order not found')); }
<script type="text/javascript" src="<?php echo $contextPath; ?> template/js/jquery-ui-1.8.23.custom.min.js"></script> <script type="text/javascript" src="template/js/menu.js"></script> <script type="text/javascript"> $(function() { var galleries = $('.ad-gallery').adGallery(); }); </script> </head> <?php include_once 'view/user/header.php'; include_once $contextPath . 'controller/ProductController.php'; $presentType = 2; $productList = ProductController::getProducts(null, null, $presentType); ?> <div id="contain" class="contain box-transparent"> <div class="ad-gallery" style="padding: 20px;"> <div class="ad-image-wrapper"></div> <div class="ad-controls"></div> <div class="ad-nav" style="width: 50%; margin: auto"> <div class="ad-thumbs"> <ul class="ad-thumb-list"> <?php foreach ($productList as $product) { ?> <li > <a href="<?php echo $contextPath . $product['Cover_Img'];
/** * @return RequestValidator */ public function createFormValidator($rpp) { $validator = $this->getValidator('RecurringProductPeriodForm_' . ($rpp['ID'] ? $rpp['ID'] : ''), $this->request); $validator->addCheck('name', new IsNotEmptyCheck($this->translate('_error_the_name_should_not_be_empty'))); $validator->addCheck('periodLength', new IsNotEmptyCheck($this->translate('_error_period_length_should_not_be_empty'))); // $validator->addCheck('rebillCount', new IsNotEmptyCheck($this->translate('_error_rebill_count_should_not_be_empty'))); $validator->addCheck('periodLength', new IsNumericCheck($this->translate('_error_period_length_expected_positive_numeric'))); // $validator->addCheck('rebillCount', new IsNumericCheck($this->translate('_error_rebill_count_expected_positive_numeric'))); $validator->addCheck('periodLength', new MinValueCheck($this->translate('_error_period_length_expected_positive_numeric'), 1)); // $validator->addCheck('rebillCount', new MinValueCheck($this->translate('_error_rebill_count_expected_positive_numeric'), 1)); $validator->addFilter('periodLength', new NumericFilter()); // $validator->addFilter('rebillCount', new NumericFilter()); ProductController::addPricesValidator($validator, 'ProductPrice_period_'); // setup price is not required. $validator->addFilter('ProductPrice_setup_price', new NumericFilter()); foreach ($this->getApplication()->getCurrencyArray() as $currency) { $validator->addFilter('ProductPrice_setup_price_' . $currency, new NumericFilter()); } return $validator; }
<?php require_once "../../controller/ProductController.php"; $product = ProductController::GetProductByID($_REQUEST["id"]); ?> <div id="wrapper"> <div id="content"> <div id="box"> <h3 id="adduser">PRODUCT</h3> <form id="form" action="action/action_product.php" method="post"> <fieldset id="personal"> <legend> INFORMATION </legend> <p>ID : <?php echo $product["ID"]; ?> </p> <p>Name : <?php echo $product["Name"]; ?> </p> <p>Description : <?php echo $product["Description"]; ?> </p> <p>Type : <?php echo $product["Type"]; ?> </p> <p>Sub_Type : <?php
public function testTest() { $controller = new ProductController(); $controller->categoryAction('hallo'); }
for ($i = 0; $i < count($roles); $i++) { if ($i == $product["Promotion_ID"]) { //select first option echo "<option selected='selected' value='" . $roles[$i]["ID"] . "'>" . $roles[$i]["Name"] . "</option>"; } else { echo "<option value='" . $roles[$i]["ID"] . "'>" . $roles[$i]["Name"] . "</option>"; } } ?> </select> <br /> <label for="present_type">Present_Type : </label> <select name="present_type" id="present_type"> <?php $roles = ProductController::GetProductPresentTypes(); for ($i = 0; $i < count($roles); $i++) { if ($i == 0) { //select first option echo "<option selected='selected' value='" . $roles[$i]["ID"] . "'>" . $roles[$i]["Name"] . "</option>"; } else { echo "<option value='" . $roles[$i]["ID"] . "'>" . $roles[$i]["Name"] . "</option>"; } } ?> </select> <br /> <label for="price">Price : </label> <input name="price" id="price" type="text" value="<?php echo $product["Price"] / 1000;
# $p['esdate'] = $_GET['esdate'];//結束時間 # $p['eedate'] = $_GET['eedate'];//結束時間 $pos = 1; $_SESSION['p'] = $p; } else { $p = $_SESSION['p']; } if ($pos == "") { $pos = $_SESSION['page']; } $_SESSION['page'] = $pos; #煥頁時,指定action 為 list if ($action == "" and $pos > 0) { $action = "list"; } $a = new ProductController($conn); $a->lang = $lang; $a->UserLevel = $UserLevel; $a->UserID = $UserID; $a->lang_str = $lang_str; switch ($action) { case "list": $a->browse($p, 10, $pos); break; case "add": $a->add(); break; case "edit": $a->edit($id); break; case "show":
<thead> <tr> <th width="40px"><a href="#">ID<img src="img/icons/arrow_down_mini.gif" width="16" height="16" align="absmiddle" /></a></th> <th><a href="#">Name</a></th> <th><a href="#">Description</a></th> <th width="90px"><a href="#">Type</a></th> <th width="50px"><a href="#">Sub_Type</a></th> <th width="90px"><a href="#">Price</a></th> <th width="60px"><a href="#">Action</a></th> </tr> </thead> <tbody> <?php require_once "../../controller/ProductController.php"; $totalItems = ProductController::Count(); $products = ProductController::GetAll(0, $totalItems); foreach ($products as $product) { ?> <tr> <td class="a-center"><?php echo $product["ID"]; ?> </td> <td><a href="?action=view&<?php echo "id=" . $product["ID"]; ?> "><?php echo $product["Name"]; ?> </a></td> <td><?php
//Einbinden von Controllers include_once 'controller/UserController.php'; include_once 'controller/ShoppingCartController.php'; include_once 'controller/ProductController.php'; include_once 'controller/CustomerController.php'; include_once 'controller/OrderController.php'; //Session wird gestartet session_start(); //op = operation, Server übergibt den wert von 'op', von allen Server Variablen($_POST,$_GET,usw.) @($op = $_REQUEST['op']); //pr = productnummer die vom Shop ausgewählt wird, -1 weil Index bei 0 anfängt @($pr = $_REQUEST['pr'] - 1); //Controllers werden instanziert, damit wir ihre Funktionen im index brauchen können $user_controller = new UserController(); $cart_controller = new ShoppingCartController(); $prod_controller = new ProductController(); $cust_controller = new CustomerController(); $order_controller = new orderController(); /******************************* Anhand des Wertes von op, also der gesuchten Funktion im Index, werden auf verschiedene Seiten gezeigt und /oder verschiedene Funktionen eines Controllers durchgeführt. z.B versucht der User einzuloggen wird im Forumular über $_POST login button (mit name "op"!)die login Funktion des Indexes aufgerufen. Ist die Authentifizierung erfolgreich wird der User auf den Shop (ShopView.php) verlinkt. Alle Verlinkungen verlaufen durch den Index. ******************************/ switch ($op) { //verweist einen leeren op an die Loginseite (erste Ladung des Shops) case "": header("Location:./view/LoginView.php");
$curPage = (int) $_GET["page"]; } $curPage = $curPage > 0 ? $curPage : 1; $curItem = ($curPage - 1) * $maxItems; ?> <?php include_once 'header.php'; ?> <?php require_once "../../controller//ProductController.php"; $type = null; $subtype = null; $presentType = '1'; $productList = null; $productList = ProductController::getProductsOnPage($type, $subtype, $presentType, $curItem, $maxItems); $totalItems = ProductController::getProductsOnPageCount($type, $subtype, $presentType); echo ' <script type="text/javascript"> var array = $("ul#nav > li"); for ( var int = 0; int < array.length; int++) { var array_element = array[int]; if ($(array_element).attr("id") == "selected") { $(array_element).attr("id", ""); } } </script>'; echo ' <script type="text/javascript"> var array = $("ul#nav > li"); for ( var int = 0; int < array.length; int++) { $(array[6]).attr("id", "selected"); } </script>';
<?php require_once 'Autoloader.php'; /* create a product controller and configure it as following: * - Lawnmower * - Robot */ $controller = new ProductController("key.title.robot", ProductType::CLASS_LAWNMOVER, ProductType::TYPE_ROBOT); // let the controller handle the request $controller->handleRequest(); // render the page and print it echo $controller->displayPage();
$productController->index(); } else { if ($_GET['c'] == 'product/create') { if ($_SERVER['REQUEST_METHOD'] === 'POST') { $productController = new ProductController(); $productController->createPost(); } else { $productController = new ProductController(); $productController->create(); } } else { if ($_GET['c'] == 'product/edit') { if ($_SERVER['REQUEST_METHOD'] === 'POST') { $productController = new ProductController(); $productController->editPost($_GET['id']); } else { $productController = new ProductController(); $productController->edit($_GET['id']); } } else { if ($_GET['c'] == 'product/delete') { $productController = new ProductController(); $productController->delete($_GET['id']); } } } } } else { $productController = new ProductController(); $productController->index(); }
private function addProductToCart($id, $prefix = '') { if ($prefix && !$this->request->get($prefix . 'count')) { return '"'; } $product = Product::getInstanceByID($id, true, array('Category')); $productRedirect = new ActionRedirectResponse('product', 'index', array('id' => $product->getID(), 'query' => 'return=' . $this->request->get('return'))); if (!$product->isAvailable()) { $productController = new ProductController($this->application); $productController->setErrorMessage($this->translate('_product_unavailable')); return $productRedirect; } $variations = !$product->parent->get() ? $product->getVariationData($this->application) : array(); ClassLoader::import('application.controller.ProductController'); $validator = ProductController::buildAddToCartValidator($product->getOptions(true)->toArray(), $variations, $prefix); if (!$validator->isValid()) { return $productRedirect; } // check if a variation needs to be added to cart instead of a parent product if ($variations) { $product = $this->getVariationFromRequest($variations); } $count = $this->request->get($prefix . 'count', 1); if ($count < $product->getMinimumQuantity()) { $count = $product->getMinimumQuantity(); } $item = $this->order->addProduct($product, $count); if ($item instanceof OrderedItem) { foreach ($product->getOptions(true) as $option) { $this->modifyItemOption($item, $option, $this->request, $prefix . 'option_' . $option->getID()); } if ($this->order->isMultiAddress->get()) { $item->save(); } } }
ProductController::crear(); break; case 'POST | productos/destruir': autorizar(); require 'controladores/products.php'; ProductController::destruir(); break; case 'GET | productos/editar': autorizar(); require 'controladores/products.php'; ProductController::editar(); break; case 'POST | producto': autorizar(); require 'controladores/products.php'; ProductController::update(); break; case 'GET | pedidos': autorizar(false); require 'controladores/requests.php'; RequestController::lista(); break; case 'POST | pedidos': autorizar(false); require 'controladores/requests.php'; RequestController::crear(); break; case 'POST | pedido/eliminar': autorizar(false); require 'controladores/requests.php'; RequestController::eliminar();