cart_update.php

来自「this the oscommerce 3.0 aplha 4」· PHP 代码 · 共 50 行

PHP
50
字号
<?php/*  $Id: $  osCommerce, Open Source E-Commerce Solutions  http://www.oscommerce.com  Copyright (c) 2006 osCommerce  This program is free software; you can redistribute it and/or modify  it under the terms of the GNU General Public License v2 (1991)  as published by the Free Software Foundation.*/  class osC_Actions_cart_update {    function execute() {      global $osC_ShoppingCart;      if (isset($_POST['products']) && is_array($_POST['products']) && !empty($_POST['products'])) {        foreach ($_POST['products'] as $product => $quantity) {          if (!is_numeric($quantity)) {            return false;          }          $product = explode('#', $product, 2);          $attributes_array = array();          if (isset($product[1])) {            $attributes = explode(';', $product[1]);            foreach ($attributes as $set) {              $attribute = explode(':', $set);              if (!is_numeric($attribute[0]) || !is_numeric($attribute[1])) {                return false;              }              $attributes_array[$attribute[0]] = $attribute[1];            }          }          $osC_ShoppingCart->add($product[0], $attributes_array, $quantity);        }      }      osc_redirect(osc_href_link(FILENAME_CHECKOUT));    }  }?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?