Zurück   xt:Commerce Webshop Shop Support > xt:Commerce Shopsoftware Community Area > PHP & MysQL Forum

Antwort
 
LinkBack Themen-Optionen Ansicht
  #1 (permalink)  
Alt 25.07.2008, 21:46
Benutzer
 
Registriert seit: 24.04.2007
Beiträge: 61
Standard php-Problem, 2 Module wollen Veränderungen an gleicher Stelle

Mir liegen 2 Module vor. Modul Merkzettel und Modul Zubehör und natürlich xt-commerce in der Verson 3.04SP2.1.

Egal wie rum ich es versuche, zuerst dieses oder jenes, ich komme nicht drauf, wie der Code angepasst werden muss.

Es geht um die Datei cart_actions.php, hier der Code des Originals:
Code:
<?php

/* -----------------------------------------------------------------------------------------
   $Id: cart_actions.php 1298 2005-10-09 13:14:44Z mz $

   XT-Commerce - community made shopping
   http://www.xt-commerce.com

   Copyright (c) 2003 XT-Commerce
   -----------------------------------------------------------------------------------------
   based on:
   (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
   (c) 2002-2003 osCommerce(application_top.php,v 1.273 2003/05/19); www.oscommerce.com
   (c) 2003         nextcommerce (application_top.php,v 1.54 2003/08/25); www.nextcommerce.org

   Released under the GNU General Public License
   -----------------------------------------------------------------------------------------
   Third Party contribution:
   Add A Quickie v1.0 Autor  Harald Ponce de Leon

   Credit Class/Gift Vouchers/Discount Coupons (Version 5.10)
   http://www.oscommerce.com/community/contributions,282
   Copyright (c) Strider | Strider@oscworks.com
   Copyright (c  Nick Stanko of UkiDev.com, nick@ukidev.com
   Copyright (c) Andre ambidex@gmx.net
   Copyright (c) 2001,2002 Ian C Wilson http://www.phesis.org


   Released under the GNU General Public License
   ---------------------------------------------------------------------------------------*/

// Shopping cart actions
if (isset ($_GET['action'])) {
	// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
	if ($session_started == false) {
		xtc_redirect(xtc_href_link(FILENAME_COOKIE_USAGE));
	}

	if (DISPLAY_CART == 'true') {
		$goto = FILENAME_SHOPPING_CART;
		$parameters = array (
			'action',
			'cPath',
			'products_id',
			'pid'
		);
	} else {
		$goto = basename($PHP_SELF);
		if ($_GET['action'] == 'buy_now') {
			$parameters = array (
				'action',
				'pid',
				'products_id',
				'BUYproducts_id'
			);
		} else {
			$parameters = array (
				'action',
				'pid',
				'BUYproducts_id',
				'info'
			);
		}
	}
	switch ($_GET['action']) {
		// customer wants to update the product quantity in their shopping cart
		case 'update_product' :

			if (is_object($econda))
				$econda->_emptyCart();

			for ($i = 0, $n = sizeof($_POST['products_id']); $i < $n; $i++) {
					if (in_array($_POST['products_id'][$i], (is_array($_POST['cart_delete']) ? $_POST['cart_delete'] : array ()))) {
					$_SESSION['cart']->remove($_POST['products_id'][$i]);

					if (is_object($econda))
						$econda->_delArticle($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $_POST['old_qty'][$i]);

				} else {
					if ($_POST['cart_quantity'][$i] > MAX_PRODUCTS_QTY)
						$_POST['cart_quantity'][$i] = MAX_PRODUCTS_QTY;
					$attributes = ($_POST['id'][$_POST['products_id'][$i]]) ? $_POST['id'][$_POST['products_id'][$i]] : '';

					if (is_object($econda)) {
						$old_quantity = $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'][$i], $_POST['id'][$i]));
						$econda->_updateProduct($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $old_quantity);
					}

					$_SESSION['cart']->add_cart($_POST['products_id'][$i], xtc_remove_non_numeric($_POST['cart_quantity'][$i]), $attributes, false);
				}
			}
			xtc_redirect(xtc_href_link($goto, xtc_get_all_get_params($parameters)));
			break;
			// customer adds a product from the products page
		case 'add_product' :
			if (isset ($_POST['products_id']) && is_numeric($_POST['products_id'])) {
				if ($_POST['products_qty'] > MAX_PRODUCTS_QTY)
					$_POST['products_qty'] = MAX_PRODUCTS_QTY;

				if (is_object($econda)) {
					$econda->_emptyCart();
					$old_quantity = $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'], $_POST['id']));
					$econda->_addProduct($_POST['products_id'], $_POST['products_qty'], $old_quantity);
				}

				$_SESSION['cart']->add_cart((int) $_POST['products_id'], $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'], $_POST['id'])) + xtc_remove_non_numeric($_POST['products_qty']), $_POST['id']);
			}
			xtc_redirect(xtc_href_link($goto, 'products_id=' . (int) $_POST['products_id'] . '&' . xtc_get_all_get_params($parameters)));
			break;

		case 'check_gift' :
			require_once (DIR_FS_INC . 'xtc_collect_posts.inc.php');
			xtc_collect_posts();
			break;

			// customer wants to add a quickie to the cart (called from a box)
		case 'add_a_quickie' :
			$quicky = addslashes($_POST['quickie']);
			if (GROUP_CHECK == 'true') {
				$group_check = "and group_permission_" . $_SESSION['customers_status']['customers_status_id'] . "=1 ";
			}

			$quickie_query = xtc_db_query("select
						                                        products_fsk18,
						                                        products_id from " . TABLE_PRODUCTS . "
						                                        where products_model = '" . $quicky . "' " . "AND products_status = '1' " . $group_check);

			if (!xtc_db_num_rows($quickie_query)) {
				if (GROUP_CHECK == 'true') {
					$group_check = "and group_permission_" . $_SESSION['customers_status']['customers_status_id'] . "=1 ";
				}
				$quickie_query = xtc_db_query("select
								                                                 products_fsk18,
								                                                 products_id from " . TABLE_PRODUCTS . "
								                                                 where products_model LIKE '%" . $quicky . "%' " . "AND products_status = '1' " . $group_check);
			}
			if (xtc_db_num_rows($quickie_query) != 1) {
				xtc_redirect(xtc_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords=' . $quicky, 'NONSSL'));
			}
			$quickie = xtc_db_fetch_array($quickie_query);
			if (xtc_has_product_attributes($quickie['products_id'])) {
				xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $quickie['products_id'], 'NONSSL'));
			} else {
				if ($quickie['products_fsk18'] == '1' && $_SESSION['customers_status']['customers_fsk18'] == '1') {
					xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $quickie['products_id'], 'NONSSL'));
				}
				if ($_SESSION['customers_status']['customers_fsk18_display'] == '0' && $quickie['products_fsk18'] == '1') {
					xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $quickie['products_id'], 'NONSSL'));
				}
				if ($_POST['quickie'] != '') {
					$act_qty = $_SESSION['cart']->get_quantity(xtc_get_uprid($quickie['products_id'], 1));
					if ($act_qty > MAX_PRODUCTS_QTY)
						$act_qty = MAX_PRODUCTS_QTY - 1;
					$_SESSION['cart']->add_cart($quickie['products_id'], $act_qty +1, 1);
					xtc_redirect(xtc_href_link($goto, xtc_get_all_get_params(array (
						'action'
					)), 'NONSSL'));
				} else {
					xtc_redirect(xtc_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords=' . $quicky, 'NONSSL'));
				}
			}
			break;

			// performed by the 'buy now' button in product listings and review page
		case 'buy_now' :
			if (isset ($_GET['BUYproducts_id'])) {
				// check permission to view product

				$permission_query = xtc_db_query("SELECT group_permission_" . $_SESSION['customers_status']['customers_status_id'] . " as customer_group, products_fsk18 from " . TABLE_PRODUCTS . " where products_id='" . (int) $_GET['BUYproducts_id'] . "'");
				$permission = xtc_db_fetch_array($permission_query);

				// check for FSK18
				if ($permission['products_fsk18'] == '1' && $_SESSION['customers_status']['customers_fsk18'] == '1') {
					xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int) $_GET['BUYproducts_id'], 'NONSSL'));
				}
				if ($_SESSION['customers_status']['customers_fsk18_display'] == '0' && $permission['products_fsk18'] == '1') {
					xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int) $_GET['BUYproducts_id'], 'NONSSL'));
				}

				if (GROUP_CHECK == 'true') {

					if ($permission['customer_group'] != '1') {
						xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int) $_GET['BUYproducts_id']));
					}
				}
				if (xtc_has_product_attributes($_GET['BUYproducts_id'])) {
					xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int) $_GET['BUYproducts_id']));
				} else {
					if (isset ($_SESSION['cart'])) {


						if (is_object($econda)) {
							$econda->_emptyCart();
							$old_quantity = $_SESSION['cart']->get_quantity((int) $_GET['BUYproducts_id']);
							$econda->_addProduct($_GET['BUYproducts_id'], $old_quantity +1, $old_quantity);
						}

						$_SESSION['cart']->add_cart((int) $_GET['BUYproducts_id'], $_SESSION['cart']->get_quantity((int) $_GET['BUYproducts_id']) + 1);
					} else {
						xtc_redirect(xtc_href_link(FILENAME_DEFAULT));
					}
				}
			}
			xtc_redirect(xtc_href_link($goto, xtc_get_all_get_params(array (
				'action',
				'BUYproducts_id'
			))));
			break;
		case 'cust_order' :
			if (isset ($_SESSION['customer_id']) && isset ($_GET['pid'])) {
				if (xtc_has_product_attributes((int) $_GET['pid'])) {
					xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int) $_GET['pid']));
				} else {
					$_SESSION['cart']->add_cart((int) $_GET['pid'], $_SESSION['cart']->get_quantity((int) $_GET['pid']) + 1);
				}
			}
			xtc_redirect(xtc_href_link($goto, xtc_get_all_get_params($parameters)));
			break;
	}
}
?>
Der Stand ist nun folgender, ich habe zuerst das Modul Merkzettel installiert nach folgender Anleitung für die cart_actions.php:
Code:
shop/includes/cart_actions.php

das suchen :

switch ($_GET['action']) {
		// customer wants to update the product quantity in their shopping cart
		case 'update_product' :
			for ($i = 0, $n = sizeof($_POST['products_id']); $i < $n; $i ++) {
				if (in_array($_POST['products_id'][$i], (is_array($_POST['cart_delete']) ? $_POST['cart_delete'] : array ()))) {
					$_SESSION['cart']->remove($_POST['products_id'][$i]);
				} else {
					if ($_POST['cart_quantity'][$i] > MAX_PRODUCTS_QTY)
						$_POST['cart_quantity'][$i] = MAX_PRODUCTS_QTY;
					$attributes = ($_POST['id'][$_POST['products_id'][$i]]) ? $_POST['id'][$_POST['products_id'][$i]] : '';
					$_SESSION['cart']->add_cart($_POST['products_id'][$i], xtc_remove_non_numeric($_POST['cart_quantity'][$i]), $attributes, false);
				}
			}
			

hiermit ersetzen :


switch ($_GET['action']) {// customer wants to update the product quantity in their shopping cart
		case 'update_product' :
		
		if (is_object($econda))
				$econda->_emptyCart();
				
			for ($i = 0, $n = sizeof($_POST['products_id']); $i < $n; $i ++) {
				if($_POST['submit_target'] == 'wishlist') //WISHLIST ############
				{ 
					if (in_array($_POST['products_id'][$i], (is_array($_POST['cart_delete']) ? $_POST['cart_delete'] : array()))) {
						$_SESSION['wishList']->remove($_POST['products_id'][$i]);
					} else {
						if ($_POST['cart_quantity'][$i]>MAX_PRODUCTS_QTY) $_POST['cart_quantity'][$i]=MAX_PRODUCTS_QTY;
						$attributes = ($_POST['id'][$_POST['products_id'][$i]]) ? $_POST['id'][$_POST['products_id'][$i]] : '';
						$_SESSION['wishList']->add_cart($_POST['products_id'][$i], xtc_remove_non_numeric($_POST['cart_quantity'][$i]), $attributes, false);
					}
					$goto = 'wish_list.php';
					
					
					if (is_object($econda))
						$econda->_delArticle($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $_POST['old_qty'][$i]);

				}
				else //CART ############
				{  
					if (in_array($_POST['products_id'][$i], (is_array($_POST['cart_delete']) ? $_POST['cart_delete'] : array()))) {
						$_SESSION['cart']->remove($_POST['products_id'][$i]);
					} else {
						if ($_POST['cart_quantity'][$i]>MAX_PRODUCTS_QTY) $_POST['cart_quantity'][$i]=MAX_PRODUCTS_QTY;
						$attributes = ($_POST['id'][$_POST['products_id'][$i]]) ? $_POST['id'][$_POST['products_id'][$i]] : '';
						$_SESSION['cart']->add_cart($_POST['products_id'][$i], xtc_remove_non_numeric($_POST['cart_quantity'][$i]), $attributes, false);
					}
					if (is_object($econda)) {
						$old_quantity = $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'][$i], $_POST['id'][$i]));
						$econda->_updateProduct($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $old_quantity);
					
				} //END wishlist/cart ############
			}
			}

---------------------------

das suchen :

		$_SESSION['cart']->add_cart((int) $_POST['products_id'], $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'], $_POST['id'])) + xtc_remove_non_numeric($_POST['products_qty']), $_POST['id']);


hiermit ersetzen :

if($_POST['submit_target'] == 'wishlist') {
					$_SESSION['wishList']->add_cart((int)$_POST['products_id'], $_SESSION['wishList']->get_quantity(xtc_get_uprid($_POST['products_id'], $_POST['id']))+$_POST['products_qty'], $_POST['id']);
					$goto = 'wish_list.php';
				} else {
					$_SESSION['cart']->add_cart((int)$_POST['products_id'], $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'], $_POST['id']))+$_POST['products_qty'], $_POST['id']);
				}

***
Die neue cart_actions sieht danach also so aus:
Code:
<?php

/* -----------------------------------------------------------------------------------------
   $Id: cart_actions.php 1298 2005-10-09 13:14:44Z mz $

   XT-Commerce - community made shopping
   http://www.xt-commerce.com

   Copyright (c) 2003 XT-Commerce
   -----------------------------------------------------------------------------------------
   based on:
   (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
   (c) 2002-2003 osCommerce(application_top.php,v 1.273 2003/05/19); www.oscommerce.com
   (c) 2003         nextcommerce (application_top.php,v 1.54 2003/08/25); www.nextcommerce.org

   Released under the GNU General Public License
   -----------------------------------------------------------------------------------------
   Third Party contribution:
   Add A Quickie v1.0 Autor  Harald Ponce de Leon

   Credit Class/Gift Vouchers/Discount Coupons (Version 5.10)
   http://www.oscommerce.com/community/contributions,282
   Copyright (c) Strider | Strider@oscworks.com
   Copyright (c  Nick Stanko of UkiDev.com, nick@ukidev.com
   Copyright (c) Andre ambidex@gmx.net
   Copyright (c) 2001,2002 Ian C Wilson http://www.phesis.org


   Released under the GNU General Public License
   ---------------------------------------------------------------------------------------*/

// Shopping cart actions
if (isset ($_GET['action'])) {
        // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
        if ($session_started == false) {
                xtc_redirect(xtc_href_link(FILENAME_COOKIE_USAGE));
        }

        if (DISPLAY_CART == 'true') {
                $goto = FILENAME_SHOPPING_CART;
                $parameters = array (
                        'action',
                        'cPath',
                        'products_id',
                        'pid'
                );
        } else {
                $goto = basename($PHP_SELF);
                if ($_GET['action'] == 'buy_now') {
                        $parameters = array (
                                'action',
                                'pid',
                                'products_id',
                                'BUYproducts_id'
                        );
                } else {
                        $parameters = array (
                                'action',
                                'pid',
                                'BUYproducts_id',
                                'info'
                        );
                }
        }
        switch ($_GET['action']) {// customer wants to update the product quantity in their shopping cart
                case 'update_product' :

                if (is_object($econda))
                                $econda->_emptyCart();

                        for ($i = 0, $n = sizeof($_POST['products_id']); $i < $n; $i ++) {
                                if($_POST['submit_target'] == 'wishlist') //WISHLIST ############
                                {
                                        if (in_array($_POST['products_id'][$i], (is_array($_POST['cart_delete']) ? $_POST['cart_delete'] : array()))) {
                                                $_SESSION['wishList']->remove($_POST['products_id'][$i]);
                                        } else {
                                                if ($_POST['cart_quantity'][$i]>MAX_PRODUCTS_QTY) $_POST['cart_quantity'][$i]=MAX_PRODUCTS_QTY;
                                                $attributes = ($_POST['id'][$_POST['products_id'][$i]]) ? $_POST['id'][$_POST['products_id'][$i]] : '';
                                                $_SESSION['wishList']->add_cart($_POST['products_id'][$i], xtc_remove_non_numeric($_POST['cart_quantity'][$i]), $attributes, false);
                                        }
                                        $goto = 'wish_list.php';


                                        if (is_object($econda))
                                                $econda->_delArticle($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $_POST['old_qty'][$i]);

                                }
                                else //CART ############
                                {
                                        if (in_array($_POST['products_id'][$i], (is_array($_POST['cart_delete']) ? $_POST['cart_delete'] : array()))) {
                                                $_SESSION['cart']->remove($_POST['products_id'][$i]);
                                        } else {
                                                if ($_POST['cart_quantity'][$i]>MAX_PRODUCTS_QTY) $_POST['cart_quantity'][$i]=MAX_PRODUCTS_QTY;
                                                $attributes = ($_POST['id'][$_POST['products_id'][$i]]) ? $_POST['id'][$_POST['products_id'][$i]] : '';
                                                $_SESSION['cart']->add_cart($_POST['products_id'][$i], xtc_remove_non_numeric($_POST['cart_quantity'][$i]), $attributes, false);
                                        }
                                        if (is_object($econda)) {
                                                $old_quantity = $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'][$i], $_POST['id'][$i]));
                                                $econda->_updateProduct($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $old_quantity);

                                } //END wishlist/cart ############
                        }
                        }
                        xtc_redirect(xtc_href_link($goto, xtc_get_all_get_params($parameters)));
                        break;
                        // customer adds a product from the products page
                case 'add_product' :
                        if (isset ($_POST['products_id']) && is_numeric($_POST['products_id'])) {
                                if ($_POST['products_qty'] > MAX_PRODUCTS_QTY)
                                        $_POST['products_qty'] = MAX_PRODUCTS_QTY;

                                if (is_object($econda)) {
                                        $econda->_emptyCart();
                                        $old_quantity = $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'], $_POST['id']));
                                        $econda->_addProduct($_POST['products_id'], $_POST['products_qty'], $old_quantity);
                                }


if($_POST['submit_target'] == 'wishlist') {
                                        $_SESSION['wishList']->add_cart((int)$_POST['products_id'], $_SESSION['wishList']->get_quantity(xtc_get_uprid($_POST['products_id'], $_POST['id']))+$_POST['products_qty'], $_POST['id']);
                                        $goto = 'wish_list.php';
                                } else {
                                        $_SESSION['cart']->add_cart((int)$_POST['products_id'], $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'], $_POST['id']))+$_POST['products_qty'], $_POST['id']);
                                }

                        }
                        xtc_redirect(xtc_href_link($goto, 'products_id=' . (int) $_POST['products_id'] . '&' . xtc_get_all_get_params($parameters)));
                        break;

                case 'check_gift' :
                        require_once (DIR_FS_INC . 'xtc_collect_posts.inc.php');
                        xtc_collect_posts();
                        break;

                        // customer wants to add a quickie to the cart (called from a box)
                case 'add_a_quickie' :
                        $quicky = addslashes($_POST['quickie']);
                        if (GROUP_CHECK == 'true') {
                                $group_check = "and group_permission_" . $_SESSION['customers_status']['customers_status_id'] . "=1 ";
                        }

                        $quickie_query = xtc_db_query("select
                                                                                        products_fsk18,
                                                                                        products_id from " . TABLE_PRODUCTS . "
                                                                                        where products_model = '" . $quicky . "' " . "AND products_status = '1' " . $group_check);

                        if (!xtc_db_num_rows($quickie_query)) {
                                if (GROUP_CHECK == 'true') {
                                        $group_check = "and group_permission_" . $_SESSION['customers_status']['customers_status_id'] . "=1 ";
                                }
                                $quickie_query = xtc_db_query("select
                                                                                                                 products_fsk18,
                                                                                                                 products_id from " . TABLE_PRODUCTS . "
                                                                                                                 where products_model LIKE '%" . $quicky . "%' " . "AND products_status = '1' " . $group_check);
                        }
                        if (xtc_db_num_rows($quickie_query) != 1) {
                                xtc_redirect(xtc_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords=' . $quicky, 'NONSSL'));
                        }
                        $quickie = xtc_db_fetch_array($quickie_query);
                        if (xtc_has_product_attributes($quickie['products_id'])) {
                                xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $quickie['products_id'], 'NONSSL'));
                        } else {
                                if ($quickie['products_fsk18'] == '1' && $_SESSION['customers_status']['customers_fsk18'] == '1') {
                                        xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $quickie['products_id'], 'NONSSL'));
                                }
                                if ($_SESSION['customers_status']['customers_fsk18_display'] == '0' && $quickie['products_fsk18'] == '1') {
                                        xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $quickie['products_id'], 'NONSSL'));
                                }
                                if ($_POST['quickie'] != '') {
                                        $act_qty = $_SESSION['cart']->get_quantity(xtc_get_uprid($quickie['products_id'], 1));
                                        if ($act_qty > MAX_PRODUCTS_QTY)
                                                $act_qty = MAX_PRODUCTS_QTY - 1;
                                        $_SESSION['cart']->add_cart($quickie['products_id'], $act_qty +1, 1);
                                        xtc_redirect(xtc_href_link($goto, xtc_get_all_get_params(array (
                                                'action'
                                        )), 'NONSSL'));
                                } else {
                                        xtc_redirect(xtc_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords=' . $quicky, 'NONSSL'));
                                }
                        }
                        break;

                        // performed by the 'buy now' button in product listings and review page
                case 'buy_now' :
                        if (isset ($_GET['BUYproducts_id'])) {
                                // check permission to view product

                                $permission_query = xtc_db_query("SELECT group_permission_" . $_SESSION['customers_status']['customers_status_id'] . " as customer_group, products_fsk18 from " . TABLE_PRODUCTS . " where products_id='" . (int) $_GET['BUYproducts_id'] . "'");
                                $permission = xtc_db_fetch_array($permission_query);

                                // check for FSK18
                                if ($permission['products_fsk18'] == '1' && $_SESSION['customers_status']['customers_fsk18'] == '1') {
                                        xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int) $_GET['BUYproducts_id'], 'NONSSL'));
                                }
                                if ($_SESSION['customers_status']['customers_fsk18_display'] == '0' && $permission['products_fsk18'] == '1') {
                                        xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int) $_GET['BUYproducts_id'], 'NONSSL'));
                                }

                                if (GROUP_CHECK == 'true') {

                                        if ($permission['customer_group'] != '1') {
                                                xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int) $_GET['BUYproducts_id']));
                                        }
                                }
                                if (xtc_has_product_attributes($_GET['BUYproducts_id'])) {
                                        xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int) $_GET['BUYproducts_id']));
                                } else {
                                        if (isset ($_SESSION['cart'])) {


                                                if (is_object($econda)) {
                                                        $econda->_emptyCart();
                                                        $old_quantity = $_SESSION['cart']->get_quantity((int) $_GET['BUYproducts_id']);
                                                        $econda->_addProduct($_GET['BUYproducts_id'], $old_quantity +1, $old_quantity);
                                                }

                                                $_SESSION['cart']->add_cart((int) $_GET['BUYproducts_id'], $_SESSION['cart']->get_quantity((int) $_GET['BUYproducts_id']) + 1);
                                        } else {
                                                xtc_redirect(xtc_href_link(FILENAME_DEFAULT));
                                        }
                                }
                        }
                        xtc_redirect(xtc_href_link($goto, xtc_get_all_get_params(array (
                                'action',
                                'BUYproducts_id'
                        ))));
                        break;
                case 'cust_order' :
                        if (isset ($_SESSION['customer_id']) && isset ($_GET['pid'])) {
                                if (xtc_has_product_attributes((int) $_GET['pid'])) {
                                        xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . (int) $_GET['pid']));
                                } else {
                                        $_SESSION['cart']->add_cart((int) $_GET['pid'], $_SESSION['cart']->get_quantity((int) $_GET['pid']) + 1);
                                }
                        }
                        xtc_redirect(xtc_href_link($goto, xtc_get_all_get_params($parameters)));
                        break;
        }
}
?>
Jetzt möchte ich die Veränderungen für das Modul Zubehör einbauen und habe ein Problem, denn der Code, welcher verändert werden soll, ist nicht mehr so wie er war.
Hier die Anleitung für die Datei cart_actions.php des Moduls Zubehör:
Code:
// Suchen nach
// -------------------------------------------------------------------------------------------------
		case 'add_product' :
			if (isset ($_POST['products_id']) && is_numeric($_POST['products_id'])) {
				if ($_POST['products_qty'] > MAX_PRODUCTS_QTY)
					$_POST['products_qty'] = MAX_PRODUCTS_QTY;

				if (is_object($econda)) {
					$econda->_emptyCart();
					$old_quantity = $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'], $_POST['id']));
					$econda->_addProduct($_POST['products_id'], $_POST['products_qty'], $old_quantity);
				}

				$_SESSION['cart']->add_cart((int) $_POST['products_id'], $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'], $_POST['id'])) + xtc_remove_non_numeric($_POST['products_qty']), $_POST['id']);
			}
			xtc_redirect(xtc_href_link($goto, 'products_id=' . (int) $_POST['products_id'] . '&' . xtc_get_all_get_params($parameters)));
			break;
// -------------------------------------------------------------------------------------------------

// Ersetzen durch
// -------------------------------------------------------------------------------------------------
		case 'add_product' :
			if (isset($_POST['products_id'])) {
				if ($_POST['products_qty'] > MAX_PRODUCTS_QTY)
					$_POST['products_qty'] = MAX_PRODUCTS_QTY;

				if (is_object($econda)) {
					$econda->_emptyCart();
					$old_quantity = $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'], $_POST['id']));
					$econda->_addProduct($_POST['products_id'], $_POST['products_qty'], $old_quantity);
				}

				$pids = count($_POST['products_id']);
				for($i=0; $i<$pids; $i++){
					$_SESSION['cart']->add_cart((int)$_POST['products_id'][$i], $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'][$i], $_POST['id'])) + xtc_remove_non_numeric($_POST['products_qty']), $_POST['id']);
				}
			}
			xtc_redirect(xtc_href_link($goto, 'products_id=' . (int) $_POST['products_id'] . '&' . xtc_get_all_get_params($parameters)));
			break;
// -------------------------------------------------------------------------------------------------
Wie kann man das Problem lösen, an meinen Versuchen bin ich gescheitert.

mfg 0etzi
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #2 (permalink)  
Alt 08.11.2008, 12:23
Benutzerbild von mbdesign
Erfahrener Benutzer
 
Registriert seit: 22.01.2006
Beiträge: 189
Standard

Das gleiche Problem habe ich auch, gibt es dafür schon eine Lösung?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #3 (permalink)  
Alt 11.11.2008, 14:39
Erfahrener Benutzer
 
Registriert seit: 19.07.2006
Ort: Hamburg
Beiträge: 912
Standard

Wo ist denn das Problem? Das sind doch erstmal zwei unterschiedliche Stellen... Einmal wird case 'update_product' ersetzt und einmal case 'add_product', die zweite Änderung der Wishlist kann man IMHO bedenkenlos mit einbauen, da ja da eine Abfrage mit drin ist, ob das von der Wishlist kommt. Ansonsten (else) wird ja der ursprünglich "ersetzte" Code aussgeführt.

Also erst Wishlist (Merkzettel) Schritt 1, dann Zubehör, und dann Wishlist Schritt 2 einbauen.

Fertig würde das dann so aussehen (Ungetestet! Nur hier im Forum zusammengeschustert!):
PHP-Code:
<?php

/* -----------------------------------------------------------------------------------------
   $Id: cart_actions.php 1298 2005-10-09 13:14:44Z mz $

   XT-Commerce - community made shopping
   http://www.xt-commerce.com

   Copyright (c) 2003 XT-Commerce
   -----------------------------------------------------------------------------------------
   based on:
   (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
   (c) 2002-2003 osCommerce(application_top.php,v 1.273 2003/05/19); www.oscommerce.com
   (c) 2003         nextcommerce (application_top.php,v 1.54 2003/08/25); www.nextcommerce.org

   Released under the GNU General Public License
   -----------------------------------------------------------------------------------------
   Third Party contribution:
   Add A Quickie v1.0 Autor  Harald Ponce de Leon

   Credit Class/Gift Vouchers/Discount Coupons (Version 5.10)
   http://www.oscommerce.com/community/contributions,282
   Copyright (c) Strider | Strider@oscworks.com
   Copyright (c  Nick Stanko of UkiDev.com, nick@ukidev.com
   Copyright (c) Andre ambidex@gmx.net
   Copyright (c) 2001,2002 Ian C Wilson http://www.phesis.org


   Released under the GNU General Public License
   ---------------------------------------------------------------------------------------*/

// Shopping cart actions
if (isset ($_GET['action'])) {
        
// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
        
if ($session_started == false) {
                
xtc_redirect(xtc_href_link(FILENAME_COOKIE_USAGE));
        }

        if (
DISPLAY_CART == 'true') {
                
$goto FILENAME_SHOPPING_CART;
                
$parameters = array (
                        
'action',
                        
'cPath',
                        
'products_id',
                        
'pid'
                
);
        } else {
                
$goto basename($PHP_SELF);
                if (
$_GET['action'] == 'buy_now') {
                        
$parameters = array (
                                
'action',
                                
'pid',
                                
'products_id',
                                
'BUYproducts_id'
                        
);
                } else {
                        
$parameters = array (
                                
'action',
                                
'pid',
                                
'BUYproducts_id',
                                
'info'
                        
);
                }
        }
        switch (
$_GET['action']) {// customer wants to update the product quantity in their shopping cart
                
case 'update_product' :

                if (
is_object($econda))
                                
$econda->_emptyCart();

                        for (
$i 0$n sizeof($_POST['products_id']); $i $n$i ++) {
                                if(
$_POST['submit_target'] == 'wishlist'//WISHLIST ############
                                
{
                                        if (
in_array($_POST['products_id'][$i], (is_array($_POST['cart_delete']) ? $_POST['cart_delete'] : array()))) {
                                                
$_SESSION['wishList']->remove($_POST['products_id'][$i]);
                                        } else {
                                                if (
$_POST['cart_quantity'][$i]>MAX_PRODUCTS_QTY$_POST['cart_quantity'][$i]=MAX_PRODUCTS_QTY;
                                                
$attributes = ($_POST['id'][$_POST['products_id'][$i]]) ? $_POST['id'][$_POST['products_id'][$i]] : '';
                                                
$_SESSION['wishList']->add_cart($_POST['products_id'][$i], xtc_remove_non_numeric($_POST['cart_quantity'][$i]), $attributesfalse);
                                        }
                                        
$goto 'wish_list.php';


                                        if (
is_object($econda))
                                                
$econda->_delArticle($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $_POST['old_qty'][$i]);

                                }
                                else 
//CART ############
                                
{
                                        if (
in_array($_POST['products_id'][$i], (is_array($_POST['cart_delete']) ? $_POST['cart_delete'] : array()))) {
                                                
$_SESSION['cart']->remove($_POST['products_id'][$i]);
                                        } else {
                                                if (
$_POST['cart_quantity'][$i]>MAX_PRODUCTS_QTY$_POST['cart_quantity'][$i]=MAX_PRODUCTS_QTY;
                                                
$attributes = ($_POST['id'][$_POST['products_id'][$i]]) ? $_POST['id'][$_POST['products_id'][$i]] : '';
                                                
$_SESSION['cart']->add_cart($_POST['products_id'][$i], xtc_remove_non_numeric($_POST['cart_quantity'][$i]), $attributesfalse);
                                        }
                                        if (
is_object($econda)) {
                                                
$old_quantity $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'][$i], $_POST['id'][$i]));
                                                
$econda->_updateProduct($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $old_quantity);

                                } 
//END wishlist/cart ############
                        
}
                        }
                        
xtc_redirect(xtc_href_link($gotoxtc_get_all_get_params($parameters)));
                        break;
                        
                 
// customer adds a product from the products page
                 /* Hier die zweite Aenderung! - IaN */  
              
                
case 'add_product' :
            if (isset(
$_POST['products_id'])) {
                if (
$_POST['products_qty'] > MAX_PRODUCTS_QTY)
                    
$_POST['products_qty'] = MAX_PRODUCTS_QTY;

                if (
is_object($econda)) {
                    
$econda->_emptyCart();
                    
$old_quantity $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'], $_POST['id']));
                    
$econda->_addProduct($_POST['products_id'], $_POST['products_qty'], $old_quantity);
                }

                
$pids count($_POST['products_id']);
                for(
$i=0$i<$pids$i++){
                    
                                  
/* Beginn Aenderung der Aenderung ;-) - IaN */
                                  
if($_POST['submit_target'] == 'wishlist') {
                    
$_SESSION['wishList']->add_cart((int)$_POST['products_id'], $_SESSION['wishList']->get_quantity(xtc_get_uprid($_POST['products_id'], $_POST['id']))+$_POST['products_qty'], $_POST['id']);
                    
$goto 'wish_list.php';
                } else {
                    
$_SESSION['cart']->add_cart((int)$_POST['products_id'], $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'], $_POST['id']))+$_POST['products_qty'], $_POST['id']);
                }
                               
/* Ende Aenderung der Aenderung ;-) - IaN */


                
}
            }
            
xtc_redirect(xtc_href_link($goto'products_id=' . (int) $_POST['products_id'] . '&' xtc_get_all_get_params($parameters)));
            break;
                
/* Ende zweite Aenderung -- IaN */

                
case 'check_gift' :
                        require_once (
DIR_FS_INC 'xtc_collect_posts.inc.php');
                        
xtc_collect_posts();
                        break;

                        
// customer wants to add a quickie to the cart (called from a box)
                
case 'add_a_quickie' :
                        
$quicky addslashes($_POST['quickie']);
                        if (
GROUP_CHECK == 'true') {
                                
$group_check "and group_permission_" $_SESSION['customers_status']['customers_status_id'] . "=1 ";
                        }

                        
$quickie_query xtc_db_query("select
                                                                                        products_fsk18,
                                                                                        products_id from " 
TABLE_PRODUCTS "
                                                                                        where products_model = '" 
$quicky "' " "AND products_status = '1' " $group_check);

                        if (!
xtc_db_num_rows($quickie_query)) {
                                if (
GROUP_CHECK == 'true') {
                                        
$group_check "and group_permission_" $_SESSION['customers_status']['customers_status_id'] . "=1 ";
                                }
                                
$quickie_query xtc_db_query("select
                                                                                                                 products_fsk18,
                                                                                                                 products_id from " 
TABLE_PRODUCTS "
                                                                                                                 where products_model LIKE '%" 
$quicky "%' " "AND products_status = '1' " $group_check);
                        }
                        if (
xtc_db_num_rows($quickie_query) != 1) {
                                
xtc_redirect(xtc_href_link(FILENAME_ADVANCED_SEARCH_RESULT'keywords=' $quicky'NONSSL'));
                        }
                        
$quickie xtc_db_fetch_array($quickie_query);
                        if (
xtc_has_product_attributes($quickie['products_id'])) {
                                
xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO'products_id=' $quickie['products_id'], 'NONSSL'));
                        } else {
                                if (
$quickie['products_fsk18'] == '1' && $_SESSION['customers_status']['customers_fsk18'] == '1') {
                                        
xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO'products_id=' $quickie['products_id'], 'NONSSL'));
                                }
                                if (
$_SESSION['customers_status']['customers_fsk18_display'] == '0' && $quickie['products_fsk18'] == '1') {
                                        
xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO'products_id=' $quickie['products_id'], 'NONSSL'));
                                }
                                if (
$_POST['quickie'] != '') {
                                        
$act_qty $_SESSION['cart']->get_quantity(xtc_get_uprid($quickie['products_id'], 1));
                                        if (
$act_qty MAX_PRODUCTS_QTY)
                                                
$act_qty MAX_PRODUCTS_QTY 1;
                                        
$_SESSION['cart']->add_cart($quickie['products_id'], $act_qty +11);
                                        
xtc_redirect(xtc_href_link($gotoxtc_get_all_get_params(array (
                                                
'action'
                                        
)), 'NONSSL'));
                                } else {
                                        
xtc_redirect(xtc_href_link(FILENAME_ADVANCED_SEARCH_RESULT'keywords=' $quicky'NONSSL'));
                                }
                        }
                        break;

                        
// performed by the 'buy now' button in product listings and review page
                
case 'buy_now' :
                        if (isset (
$_GET['BUYproducts_id'])) {
                                
// check permission to view product

                                
$permission_query xtc_db_query("SELECT group_permission_" $_SESSION['customers_status']['customers_status_id'] . " as customer_group, products_fsk18 from " TABLE_PRODUCTS " where products_id='" . (int) $_GET['BUYproducts_id'] . "'");
                                
$permission xtc_db_fetch_array($permission_query);

                                
// check for FSK18
                                
if ($permission['products_fsk18'] == '1' && $_SESSION['customers_status']['customers_fsk18'] == '1') {
                                        
xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO'products_id=' . (int) $_GET['BUYproducts_id'], 'NONSSL'));
                                }
                                if (
$_SESSION['customers_status']['customers_fsk18_display'] == '0' && $permission['products_fsk18'] == '1') {
                                        
xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO'products_id=' . (int) $_GET['BUYproducts_id'], 'NONSSL'));
                                }

                                if (
GROUP_CHECK == 'true') {

                                        if (
$permission['customer_group'] != '1') {
                                                
xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO'products_id=' . (int) $_GET['BUYproducts_id']));
                                        }
                                }
                                if (
xtc_has_product_attributes($_GET['BUYproducts_id'])) {
                                        
xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO'products_id=' . (int) $_GET['BUYproducts_id']));
                                } else {
                                        if (isset (
$_SESSION['cart'])) {


                                                if (
is_object($econda)) {
                                                        
$econda->_emptyCart();
                                                        
$old_quantity $_SESSION['cart']->get_quantity((int) $_GET['BUYproducts_id']);
                                                        
$econda->_addProduct($_GET['BUYproducts_id'], $old_quantity +1$old_quantity);
                                                }

                                                
$_SESSION['cart']->add_cart((int) $_GET['BUYproducts_id'], $_SESSION['cart']->get_quantity((int) $_GET['BUYproducts_id']) + 1);
                                        } else {
                                                
xtc_redirect(xtc_href_link(FILENAME_DEFAULT));
                                        }
                                }
                        }
                        
xtc_redirect(xtc_href_link($gotoxtc_get_all_get_params(array (
                                
'action',
                                
'BUYproducts_id'
                        
))));
                        break;
                case 
'cust_order' :
                        if (isset (
$_SESSION['customer_id']) && isset ($_GET['pid'])) {
                                if (
xtc_has_product_attributes((int) $_GET['pid'])) {
                                        
xtc_redirect(xtc_href_link(FILENAME_PRODUCT_INFO'products_id=' . (int) $_GET['pid']));
                                } else {
                                        
$_SESSION['cart']->add_cart((int) $_GET['pid'], $_SESSION['cart']->get_quantity((int) $_GET['pid']) + 1);
                                }
                        }
                        
xtc_redirect(xtc_href_link($gotoxtc_get_all_get_params($parameters)));
                        break;
        }
}
?>
Cheers,
IaN

Geändert von John Steed (11.11.2008 um 14:47 Uhr)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
gleicher, module, phpproblem, stelle, veränderungen, wollen

Themen-Optionen
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Step_6 Funzt Nicht kleinsie Installation und Konfiguration 1 28.01.2005 12:13
Problem: Debian / Php / Gdlib larolt Installation und Konfiguration 2 22.04.2004 17:58
Php Problem totto Shopbereich 6 04.01.2004 22:00
Ich Habe Ne Frage An Die Php Profis 12345 Installation und Konfiguration 3 21.09.2003 13:22


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:18 Uhr.

Copyright © 2011 xt:Commerce GmbH / xt:Commerce International Ltd. - All Rights Reserved

xt:Commerce is a SafeCharge brand