cart_add.php

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

PHP
53
字号
<?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_add {    function execute() {      global $osC_Session, $osC_ShoppingCart, $osC_Product;      if (!isset($osC_Product)) {        $id = false;        foreach ($_GET as $key => $value) {          if ( (ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && ($key != $osC_Session->getName()) ) {            $id = $key;          }          break;        }        if (($id !== false) && osC_Product::checkEntry($id)) {          $osC_Product = new osC_Product($id);        }      }      if (isset($osC_Product)) {        if (isset($_POST['attributes']) && is_array($_POST['attributes'])) {          $osC_ShoppingCart->add($osC_Product->getID(), $_POST['attributes']);        } else {          if ($osC_Product->hasAttributes()) {            osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword()));            return false;          }          $osC_ShoppingCart->add($osC_Product->getID());        }      }      osc_redirect(osc_href_link(FILENAME_CHECKOUT));    }  }?>

⌨️ 快捷键说明

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