Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
257 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/* | ||
$Id: $ | ||
osCommerce, Open Source E-Commerce Solutions | ||
http://www.oscommerce.com | ||
Copyright (c) 2007 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. | ||
*/ | ||
|
||
/** | ||
* The osC_Actions class loads action modules to execute specific tasks | ||
*/ | ||
|
||
class osC_Actions { | ||
|
||
/** | ||
* Loads the action module to execute | ||
* | ||
* @param string $module The name of the module to execute | ||
* @access public | ||
*/ | ||
|
||
public static function parse($module) { | ||
$module = basename($module); | ||
|
||
if ( !empty($module) && file_exists('includes/modules/actions/' . $module . '.php') ) { | ||
include('includes/modules/actions/' . $module . '.php'); | ||
|
||
call_user_func(array('osC_Actions_' . $module, 'execute')); | ||
} | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
/* | ||
$Id: $ | ||
osCommerce, Open Source E-Commerce Solutions | ||
http://www.oscommerce.com | ||
Copyright (c) 2007 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 $PHP_SELF, $cPath, $messageStack, $osC_Session, $cart, $osC_Product; | ||
|
||
if ( !isset($osC_Product) ) { | ||
$id = false; | ||
|
||
foreach ( $_GET as $key => $value ) { | ||
//if ( (is_numeric($key) || preg_match('/^[a-zA-Z0-9 -_]*$/', $key)) && ($key != $osC_Session->getName()) ) { | ||
if ( (is_numeric($key) || preg_match('/^[a-zA-Z0-9 -_]*$/', $key)) ) { | ||
$id = $key; | ||
} | ||
|
||
break; | ||
} | ||
|
||
if ( ($id !== false) && osC_Product::checkEntry($id) ) { | ||
$osC_Product = new osC_Product($id); | ||
} | ||
} | ||
|
||
if ( isset($osC_Product) ) { | ||
if ( $osC_Product->hasVariants() ) { | ||
if ( isset($_POST['variants']) && is_array($_POST['variants']) && !empty($_POST['variants']) ) { | ||
if ( $osC_Product->variantExists($_POST['variants']) ) { | ||
$cart->add_cart($osC_Product->getProductVariantID($_POST['variants'])); | ||
} else { | ||
tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, $osC_Product->getKeyword())); | ||
|
||
return false; | ||
} | ||
} else { | ||
tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, $osC_Product->getKeyword())); | ||
|
||
return false; | ||
} | ||
} else { | ||
$cart->add_cart($osC_Product->getID()); | ||
} | ||
} | ||
$messageStack->add_session('product_action', sprintf(PRODUCT_ADDED, $osC_Product->getTitle()), 'success'); | ||
|
||
if (DISPLAY_CART == 'true') { | ||
$goto = FILENAME_SHOPPING_CART; | ||
tep_redirect(tep_href_link($goto, null)); | ||
} else { | ||
$goto = $PHP_SELF; | ||
if(isset($_GET['cPath'])){ | ||
tep_redirect(tep_href_link($goto.'?cPath='.$_GET['cPath'], null)); | ||
}else{ | ||
tep_redirect(tep_href_link($goto, $osC_Product->getKeyword())); | ||
} | ||
} | ||
|
||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/* | ||
$Id: $ | ||
osCommerce, Open Source E-Commerce Solutions | ||
http://www.oscommerce.com | ||
Copyright (c) 2007 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_remove { | ||
function execute() { | ||
global $PHP_SELF, $messageStack, $cart; | ||
|
||
|
||
|
||
if ( is_numeric($_GET['item']) ) { | ||
$messageStack->add_session('product_action', sprintf(PRODUCT_REMOVED, $cart->contents[$_GET['item']]['name']), 'warning'); | ||
$cart->remove($_GET['item']); | ||
} | ||
|
||
if (DISPLAY_CART == 'true') { | ||
$goto = FILENAME_SHOPPING_CART; | ||
$parameters = array('action', 'cPath', 'products_id', 'pid'); | ||
} else { | ||
$goto = $PHP_SELF; | ||
$parameters = array('action', 'pid'); | ||
|
||
} | ||
|
||
tep_redirect(tep_href_link($goto, null)); | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/* | ||
$Id: $ | ||
osCommerce, Open Source E-Commerce Solutions | ||
http://www.oscommerce.com | ||
Copyright (c) 2015 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 $PHP_SELF, $cart; | ||
|
||
if ( isset($_POST['products']) && is_array($_POST['products']) && !empty($_POST['products']) ) { | ||
foreach ( $_POST['products'] as $item_id => $quantity ) { | ||
if ( !is_numeric($item_id) || !is_numeric($quantity) ) { | ||
return false; | ||
} | ||
|
||
$cart->update($item_id, $quantity); | ||
|
||
} | ||
} | ||
|
||
if (DISPLAY_CART == 'true') { | ||
$goto = FILENAME_SHOPPING_CART; | ||
$parameters = array('action', 'cPath', 'products_id', 'pid'); | ||
} else { | ||
$goto = $PHP_SELF; | ||
$parameters = array('action', 'pid'); | ||
|
||
} | ||
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.