Jump to content
vojcek89

Ajax Košík - Při Vložení Do Košíku Dříve Objednaného Zboží Vyskočí Chyba

Recommended Posts

Zdravím,

na e-shopu se mi projevuje zvláštní chyba. Pokud mám zapnutý ajax košík a vložím do košíku produkt, který byl již dříve objednán, tak se mi zobrazí chyba, viz. Error.png

 

Jedná se třeba o tento produkt:

http://www.manzetky.cz/luxusni-manzetove-knoflicky/manzetove-knoflicky-tygri-oko-trojhran.html

Je zvláštní, že se produkt do košíku vloží (neprojde pouze přes pop up okno).

 

 

U produktů, které ještě nebyly objednané, se tato chyba nezobrazí. Vyskočí klasické popup okno, kde se zobrazí informace jestli chce zákazník pokračovat v nákupu nebo přejít do košíku. Viz. třeba zde: http://www.manzetky.cz/luxusni-manzetove-knoflicky/manzetove-knoflicky-zelva.html

 

Pokud povolím debug mod a zkusím vložit produkt do košíku, tak se mi zobrazí toto:

http://www.manzetky.cz/Debug_error.png

 

Budu vděčný za každou radu, jak tu chybu odstranit.

Edited by vojcek89

Share this post


Link to post
Share on other sites

To nejzajímavější je schováno mimo obrázek, na řádku začínajícím Strict Standards. Problém je v té třídě (Link ?), která je v /override podadresáři. Způsobuje to nějaký modul.

Share this post


Link to post
Share on other sites

Celý ten řádek je:

Strict Standards: Declaration of Link::getCategoryLink() should be compatible with LinkCore::getCategoryLink($category, $alias = NULL, $id_lang = NULL, $selected_filters = NULL, $id_shop = NULL, $relative_protocol = false) in /data/web/virtuals/105476/virtual/www/override/classes/Link.php on line 0

 

nedává my to smysl, proč to odkazuje na řádek 0. Zde je text toto Link.php:

<?php
/*
* 2013 Ha!*!*y
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* It is available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
*
* DISCLAIMER
* This code is provided as is without any warranty.
* No promise of being safe or secure
*
*  @author      Ha!*!*y <ha99ys@gmail.com>
*  @copyright   2012-2013 Ha!*!*y
*  @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  @code sorce: http://prestashop.com
*/
class Link extends LinkCore
{
	/**
	 * Create a link to a category
	 *
	 * @param mixed $category Category object (can be an ID category, but deprecated)
	 * @param string $alias
	 * @param int $id_lang
	 * @param string $selected_filters Url parameter to autocheck filters of the module blocklayered
	 * @return string
	 */
	/*
	* module: cleanurls
	* date: 2015-08-07 19:43:32
	* version: 0.42
	*/
	public function getCategoryLink($category, $alias = null, $id_lang = null, $selected_filters = null, $id_shop = null)
	{
		if (!$id_lang)
			$id_lang = Context::getContext()->language->id;
		
		if ($id_shop === null)
			$shop = Context::getContext()->shop;
		else
			$shop = new Shop($id_shop);
		$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
		if (!is_object($category))
			$category = new Category($category, $id_lang);
		$params = array();
		$params['id'] = $category->id;
		$params['rewrite'] = (!$alias) ? $category->link_rewrite : $alias;
		$params['meta_keywords'] =	Tools::str2url($category->meta_keywords);
		$params['meta_title'] = Tools::str2url($category->meta_title);
		$selected_filters = is_null($selected_filters) ? '' : $selected_filters;
		if (empty($selected_filters))
			$rule = 'category_rule';
		else
		{
			$rule = 'layered_rule';
			$params['selected_filters'] = $selected_filters;
		}
			$cats = array();
			$subCategories = $this->_getParentsCategories($category->id);
			$subCategories = is_array($subCategories) === TRUE ? array_reverse($subCategories) : $subCategories;
			$skip_list = Link::$category_disable_rewrite;
			$skip_list[] = $category->id;
			foreach ($subCategories as $cat)
			{
				if (!in_array($cat['id_category'], $skip_list))//remove root and home category from the URL
					$cats[] = $cat['link_rewrite'];
			}
			$params['categories'] = implode('/', $cats);
		
		return $url.Dispatcher::getInstance()->createUrl($rule, $id_lang, $params, $this->allow);
	}
	/**
	 * Get Each parent category of this category until the root category
	 *
	 * @param integer $id_lang Language ID
	 * @return array Corresponding categories
	 */
	/*
	* module: cleanurls
	* date: 2015-08-07 19:43:32
	* version: 0.42
	*/
	public function _getParentsCategories($id_current = NULL)
	{
		$context = Context::getContext()->cloneContext();
		$context->shop = clone($context->shop);
		$id_lang = $context->language->id;
		$categories = null;
		if (count(Category::getCategoriesWithoutParent()) > 1 && Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && count(Shop::getShops(true, null, true)) != 1)
			$context->shop->id_category = Category::getTopCategory()->id;
		elseif (!$context->shop->id)
			$context->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
		$id_shop = $context->shop->id;
		while (true)
		{
			$sql = '
			SELECT c.*, cl.*
			FROM `'._DB_PREFIX_.'category` c
			LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
				ON (c.`id_category` = cl.`id_category`
				AND `id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').')';
			if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP)
				$sql .= '
			LEFT JOIN `'._DB_PREFIX_.'category_shop` cs
				ON (c.`id_category` = cs.`id_category` AND cs.`id_shop` = '.(int)$id_shop.')';
			$sql .= '
			WHERE c.`id_category` = '.(int)$id_current;
			if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP)
				$sql .= '
				AND cs.`id_shop` = '.(int)$context->shop->id;
			$root_category = Category::getRootCategory();
			if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP &&
				(!Tools::isSubmit('id_category') ||
					(int)Tools::getValue('id_category') == (int)$root_category->id ||
					(int)$root_category->id == (int)$context->shop->id_category))
				$sql .= '
					AND c.`id_parent` != 0';
			$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
			if (isset($result[0]))
				$categories[] = $result[0];
			else if (!$categories)
				$categories = array();
			if (!$result || ($result[0]['id_category'] == $context->shop->id_category))
				return $categories;
			$id_current = $result[0]['id_parent'];
		}
	}
	/**
	 * Get pagination link
	 *
	 * @param string $type Controller name
	 * @param int $id_object
	 * @param boolean $nb Show nb element per page attribute
	 * @param boolean $sort Show sort attribute
	 * @param boolean $pagination Show page number attribute
	 * @param boolean $array If false return an url, if true return an array
	 */
	/*
	* module: cleanurls
	* date: 2015-08-07 19:43:32
	* version: 0.42
	*/
	public function getPaginationLink($type, $id_object, $nb = false, $sort = false, $pagination = false, $array = false)
	{
		if (!$type && !$id_object)
		{
			$method_name = 'get'.Dispatcher::getInstance()->getController().'Link';
			if (method_exists($this, $method_name) && isset($_GET['id_'.Dispatcher::getInstance()->getController()]))
			{
				$type = Dispatcher::getInstance()->getController();
				$id_object = $_GET['id_'.$type];
			}
		}
		if ($type && $id_object)
			$url = $this->{'get'.$type.'Link'}($id_object, null);
		else
		{
			if (isset(Context::getContext()->controller->php_self))
				$name = Context::getContext()->controller->php_self;
			else
				$name = Dispatcher::getInstance()->getController();
			$url = $this->getPageLink($name);
		}
		$vars = array();
		$vars_nb = array('n', 'search_query');
		$vars_sort = array('orderby', 'orderway');
		$vars_pagination = array('p');
		foreach ($_GET as $k => $value)
		{
			if ($k != 'id_'.$type && $k != $type.'_rewrite' && $k != 'controller')
			{
				if (Configuration::get('PS_REWRITING_SETTINGS') && ($k == 'isolang' || $k == 'id_lang'))
					continue;
				$if_nb = (!$nb || ($nb && !in_array($k, $vars_nb)));
				$if_sort = (!$sort || ($sort && !in_array($k, $vars_sort)));
				$if_pagination = (!$pagination || ($pagination && !in_array($k, $vars_pagination)));
				if ($if_nb && $if_sort && $if_pagination)
				{
					if (!is_array($value))
						$vars[urlencode($k)] = $value;
					else
					{
						foreach (explode('&', http_build_query(array($k => $value), '', '&')) as $key => $val)
						{
							$data = explode('=', $val);
							$vars[urldecode($data[0])] = $data[1];
						}
					}
				}
			}
		}
		if (!$array)
			if (count($vars))
				return $url.(($this->allow == 1 || $url == $this->url) ? '?' : '&').http_build_query($vars, '', '&');
			else
				return $url;
		
		$vars['requestUrl'] = $url;
		if ($type && $id_object)
			$vars['id_'.$type] = (is_object($id_object) ? (int)$id_object->id : (int)$id_object);
			
		if (!$this->allow == 1)
			$vars['controller'] = Dispatcher::getInstance()->getController();
		return $vars;
	}
}

Edited by vojcek89

Share this post


Link to post
Share on other sites

To je otázka pro Ha!*!*y. Každopádně metoda getCategoryLink není úplně v pořádku.

Share this post


Link to post
Share on other sites

Je to vyřešeno. Problém způsoboval zapnutý křížový prodej v modulu košíku. Když jsem to vypnul, tak vše funguje.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More