• My account
    • (X)Sign in

      I am a returning customer at TYPO3 Multishop

      Enter your username and password here in order to log in on the website:

      Forgot your password?

      Not yet customer of TYPO3 Multishop?

      • Order history
      • Automatic generated e-mail history
      • Track your Order
      New at TYPO3 Multishop
You are here:

Help by translating Multishop in your local language

On the following page you can help by translating Multishop in your local language:

https://translation.typo3.org/projects/TYPO3.ext.multishop/

Spanish:

https://translation.typo3.org/es/TYPO3.ext.multishop/pi1/locallang.xlf

The following language are already translated by our supporters:

  • Dutch
  • German
  • French

Costom products_to_basket file


Author Message
johannes
johannes
Multishop newbie
Topic creator
registered since: 24.06.2014
Posts: 3
I get used to it and it is awsome!

Some things are unclear.
How to link a costom products_to_basket.php to my fileadmin for costomising?

I want to show the total_price_including_vat in the cart while adding it via ajax.

PHP
<?php
if (!defined('TYPO3_MODE')) {
	die('Access denied.');
}
require_once(t3lib_extMgm::extPath('multishop').'pi1/classes/class.tx_mslib_cart.php');
$mslib_cart=t3lib_div::makeInstance('tx_mslib_cart');
$mslib_cart->init($this);
$data=array();
if ($this->post['products_id']) {
	$product=mslib_fe::getProduct($this->post['products_id']);
	if ($product['products_id']) {
		$mslib_cart->updateCart();
		$data['added_product']['products_name']=$product['products_name'];
		$data['added_product']['products_model']=$product['products_model'];
	}
}
//$cart = $GLOBALS['TSFE']->fe_user->getKey('ses',$this->cart_page_uid);
$cart=$mslib_cart->getCart();
$totalitems=0;
if (count($cart['products'])>0) {
	foreach ($cart['products'] as $product) {
		if ($product['qty']>0) {
			$totalitems=$totalitems+$product['qty'];
            $totalamount=$totalamount+($product['total_price_including_vat']);
		}
	}
}
$totalitems=ceil($totalitems);
// hook
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/ajax_pages/products_to_basket.php']['CartItemsCountLabelPostHook'])) {
	$params=array(
		'cart'=>&$cart,
		'totalitems'=>&$totalitems
	);
	foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/scripts/ajax_pages/products_to_basket.php']['CartItemsCountLabelPostHook'] as $funcRef) {
		t3lib_div::callUserFunction($funcRef, $params, $this);
	}
}
// hook oef					
$data['cartCount']=$totalitems;
$data['totalamount']=$totalamount;
$data['cartMessage']=(($totalitems==1) ? sprintf($this->pi_getLL('you_have_item_in_your_cart'), $totalitems) : sprintf($this->pi_getLL('you_have_items_in_your_cart'), $totalitems));
if ($totalitems>0) {
	$basket_link=mslib_fe::typolink($this->conf['shoppingcart_page_pid'], '&tx_multishop_pi1[page_section]=shopping_cart');
	$data['cartMessage']='<a href="'.$basket_link.'">'.$data['cartMessage'].'</a>';
}
$cart=$mslib_cart->getCart();
$data['cartContents']=$mslib_cart->getHtmlCartContents('ajaxProductsToBasket');
echo json_encode($data, ENT_NOQUOTES);
exit();
?>


Thanks

[This article was edited 1 times, at last 21.07.2014 at 13:31.]
Written on: 21. 07. 2014 [13:29]
bas
Bas van Beek
Multishop guru
registered since: 12.05.2010
Posts: 644
We create a custom plugin for this and then connect the custom plugin to the customAjaxPage method of Multishop.

You could download our custom plugin skeleton here:

https://bitbucket.org/multishop/multishop_custom

Here you can see the class:

https://bitbucket.org/multishop/multishop_custom/src/9d97727e603930adb486967bd2c84a1c79bf7c53/class.multishop_custom.php?at=master

This one you should adjust:
PHP
function customAjaxPage(&$params, &$ref) {
		self::construct($ref);
		switch ($this->get['tx_multishop_custom_pi1']['page_section']) {
			case 'interface1':
				require(t3lib_extMgm::extPath('multishop_custom').'scripts/ajax_pages/interface1.php');
				break;
		}
		$params['content'].=$content;
	}


Then in your dispatcher you create the typlink to this ajax server script like this:

PHP
mslib_fe::typolink($ref->shop_pid.',2002', '&tx_multishop_pi1[page_section]=custom_page&tx_multishop_custom_pi1[page_section]=interface1');



Written on: 27. 10. 2014 [22:05]