• 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

Product listing: multiple select and multiple add to cart


Author Message
yilmaz
Yilmaz
Multishop experienced
Topic creator
registered since: 08.06.2013
Posts: 9
Dear forum,

I've modified the products listing type as a table list view similar to the "products_relatives/default.php". The view is fine (see attached image).



Now I would like to implement a button after the products table view which adds all selected product items to the basket, so that the farwording after the click goes to the basket page with all selected items.

Any hint for me?

Regards,

Yilmaz
Attachment

Written on: 14. 06. 2013 [13:44]
yilmaz
Yilmaz
Multishop experienced
Topic creator
registered since: 08.06.2013
Posts: 9
Dear Bas,

I need your help please!

Due to my question above I did the following steps:

- I have copied the "grid_with_detail_button.php" from the products_listing to my fileadmin/custom_scripts folder

- I have modified the "grid_with_detail_button.php" (see below my code) so that I can list the products as alternate div blocks with additional product field (stock, short_description, model etc.) see my attached screenshot. This works very fine.

- My problem is now: If the customer clicks on the "Add to cart" button, my basket is incremented (this is fine), BUT: The customer will be redirected to the product detail page!

Is it possible that only my basket will be updated and the customer still stay on the product listview until he clicks the button "Weiter zur Kasse" below right in the screenshot?

I think this is depending on the <form action="???????"... Do you have any hint for me?

My code:
PHP
<?php
	if (!$this->imageWidth) $this->imageWidth='50';
	if ($show_default_header) $content.='<div class="main-heading"><h2>POS-Materialien: '.trim($current['categories_name']).'</h2></div>';
	$content.='<ul id="product_listing">';
	$content.='<li id="productlisting_header">
			<div class="image">&nbsp;</div>
			<div class="description">SAP-Artnr.</div>
			<div class="prodname">Produktname</div>
			<div class="category">Werbemittelart</div>
			<div class="stock">Bestand</div>
			<div class="quantity">Menge</div>
		   </li>
	';
	$counter=0;
	$li_type='even';
 
	foreach ($products as $product)
	{
		if (!$li_type or $li_type=='even') $li_type='odd';
    		else				   $li_type='even';
		$where='';
		if ($product['categories_id'])
		{
			// get all cats to generate multilevel fake url
			$level=0;
			$cats=mslib_fe::Crumbar($product['categories_id']);
			$cats=array_reverse($cats);
			$where='';
			if (count($cats) > 0)
			{
				foreach ($cats as $cat)
				{
					$where.="categories_id[".$level."]=".$cat['id']."&";
					$level++;
				}
				$where=substr($where,0,(strlen($where)-1));
				$where.='&';
			}
			// get all cats to generate multilevel fake url eof
		}
		if ($product['products_url']) 	$link=$product['products_url'];
		else								$link=mslib_fe::typolink($this->shop_pid,'&'.$where.'&products_id='.$product['products_id'].'&tx_multishop_pi1[page_section]=products_detail');
		if (mslib_fe:<img src="typo3conf/ext/mm_forum//res/smilies/icon_razz.gif" alt="icon_razz.gif" />roductHasAttributes($product['products_id'])){
			$button_submit = '<a href="'.$link.'" class="ajax_link"><input name="Submit" type="submit" value="'. $this->pi_getLL('checkout') .'"/></a>';
		} else {
		        $button_submit = '<input type="text" value="" id="quantity" size="5" name="quantity">&nbsp;';
			//$button_submit .= '<input name="Submit" type="submit" value="'. $this->pi_getLL('checkout') .'"/>';
			$button_submit .= '<input name="products_id" id="products_id" type="hidden" value="'.$product['products_id'].'" /><input id="multishop_add_to_cart" name="Submit" type="submit" value="Add to cart"/>';
		}
 
		//YBC: Stock view with image
    		if ($ms['MODULES']['SHOW_STOCK_LEVEL_AS_BOOLEAN'] != 'no')
    		{
        		switch ($ms['MODULES']['SHOW_STOCK_LEVEL_AS_BOOLEAN'])
        		{
            		case 'yes_with_image':
                		if ($product['products_quantity']) 	$product['products_quantity']='<img src="'.t3lib_extMgm::siteRelPath($this->extKey).'templates/images/icons/status_green.png" alt="'.htmlspecialchars($this->pi_getLL('in_stock')).'" title="'.htmlspecialchars($this->pi_getLL('in_stock')).'">';
                		else								$product['products_quantity']='<img src="'.t3lib_extMgm::siteRelPath($this->extKey).'templates/images/icons/status_red.png" alt="'.htmlspecialchars($this->pi_getLL('not_in_stock')).'" title="'.htmlspecialchars($this->pi_getLL('not_in_stock')).'">';
            		break;
            		case 'yes_without_image':
                		if ($product['products_quantity']) 	$product['products_quantity']=$this->pi_getLL('admin_yes');
                		else								$product['products_quantity']=$this->pi_getLL('admin_no');
            		break;
        		}
    		}
 
		$catlink=mslib_fe::typolink($this->shop_pid,'&'.$where.'&tx_multishop_pi1[page_section]=products_listing');
		$counter++;
		if ($product['products_image']) 	$image='<img src="'.mslib_befe::getImagePath($product['products_image'],'products',$this->imageWidth).'" alt="'.htmlspecialchars($product['products_name']).'">';
		else					$image='<div class="no_image"></div>';
 
		$content.='<li id="productlisting_'. $product['products_id'] .'" class="'.$li_type.'">
		<form action="'.mslib_fe::typolink($this->shop_pid,'&tx_multishop_pi1[page_section]=shopping_cart&products_id='.$product['products_id']).'" method="post">
 
		<div class="image"><a href="'.$link.'" title="'.htmlspecialchars($product['products_name']).'" class="ajax_link">'.$image.'</a></div>
		<div class="description">'.$product['products_shortdescription'].'</div>
		<div class="prodname"><h2>'.$product['products_name'].'</h2></div>
		<div class="category">'.$product['products_model'].'</div>
		<div class="stock">'.$product['products_quantity'].'</div>
		<div class="link_detail"><a href="'.$link.'" class="ajax_link"></a></div>
		<div class="hidden_field">
		<input type="hidden" name="quantity" value="10" />
		<input type="hidden" name="products_id" value="'.$product['products_id'].'" />
		</div>
		<div class="chart_link">'.$button_submit.'</div>
		';
		$content.='</form></li>';
 
	}
	$content.='</ul>';
	//YBC Buttons at the bottom: go to catalog / go to cash
	$content.='
	<div id="bottom-navigation"><a href="'.mslib_fe::typolink($this->shop_pid,'').'" class="proceed_to_shop">'.$this->pi_getLL('go_to_catalog').'</a>
	<div class="cart">
		<a href="'.mslib_fe::typolink($this->conf['checkout_page_pid'],'&tx_multishop_pi1[page_section]=checkout').'" class="proceed_to_checkout_button_en">'.$this->pi_getLL('proceed_to_checkout').'</a>
	</div>
	</div>
	<script>
	jQuery(document).ready(function($){
		$("#shopping_cart_form input&quot<img src="typo3conf/ext/mm_forum//res/smilies/icon_wink.gif" alt="icon_wink.gif" />.change(function(){
			if ($(this).attr("id&quot<img src="typo3conf/ext/mm_forum//res/smilies/icon_wink.gif" alt="icon_wink.gif" /> !=\'coupons_code\')
			{
				$("#shopping_cart_form&quot<img src="typo3conf/ext/mm_forum//res/smilies/icon_wink.gif" alt="icon_wink.gif" />.submit();
			}
		})
	});
	</script>
	';
 
	if ($ms['page'] <> 'products_search' and ($this->ROOTADMIN_USER or ($this->ADMIN_USER and $this->CATALOGADMIN_USER)))
	{
		$content.='
		<script>
		  jQuery(document).ready(function($) {
			var result = jQuery("#product_listing&quot<img src="typo3conf/ext/mm_forum//res/smilies/icon_wink.gif" alt="icon_wink.gif" />.sortable({
				cursor:     "move",
			    //axis:       "y",
			    update: function(e, ui) {
			        href = "'.mslib_fe::typolink(',2002','&tx_multishop_pi1[page_section]=product&catid='.$product['categories_id']).'";
			        jQuery(this).sortable("refresh&quot<img src="typo3conf/ext/mm_forum//res/smilies/icon_wink.gif" alt="icon_wink.gif" />;
			        sorted = jQuery(this).sortable("serialize", "id&quot<img src="typo3conf/ext/mm_forum//res/smilies/icon_wink.gif" alt="icon_wink.gif" />;
			        jQuery.ajax({
			                type:   "POST",
			                url:    href,
			                data:   sorted,
			                success: function(msg) {
			                        //do something with the sorted data
			                }
			        });
			    }
 
			});
		  });
		  </script>
		';
	}
?>

Thanx and regards,
Yilmaz
Attachment

Written on: 21. 06. 2013 [08:59]
yilmaz
Yilmaz
Multishop experienced
Topic creator
registered since: 08.06.2013
Posts: 9
Hi guys,

any idea from anyone? I'm stuck banghead.gif

Kind regards,

Yilmaz
Written on: 27. 06. 2013 [16:25]
yilmaz
Yilmaz
Multishop experienced
Topic creator
registered since: 08.06.2013
Posts: 9
SOLVED:

I could solve the problem as following:

- Front End login as admin > System > configuration
- Products Listing Type: copy the code below into your own fileadmin/templates/scripts/my_product_listing
- Show stock level as boolean (yes/no): yes_with_image
- Add to Cart - Redirect Back to Products Detail Page: 1
- Edit in typo3conf/ext/multishop/pi1/classes/ the file class.mslib_fe.php and substitute all "$link=mslib_fe::......=products_detail" to ""$link=mslib_fe::......=products_listing" (I think 6 times!)

I hope this helps everyone who needs it.

KR
Yilmaz

[code]
<?php
if (!$this->imageWidth) $this->imageWidth='50';
if ($show_default_header) $content.='<div class="main-heading"><h2>Nikon POS-Materialien: '.trim($current['categories_name']).'</h2></div>';
$content.='<ul id="product_listing">';
$content.='<li id="productlisting_header">
<div class="image">&nbsp;</div>
<div class="description">SAP-Artnr.</div>
<div class="prodname">Produktname</div>
<div class="category">Werbemittelart</div>
<div class="stock">Bestand</div>
<div class="quantity">Menge</div>
</li>
';

/*
if ($this->ROOTADMIN_USER or ($this->ADMIN_USER and $this->CATALOG_USER))
{
$content.='<div class="admin_menu"><a href="'.mslib_fe::typolink(',2002','&tx_multishop_pi1[page_section]=admin_ajax&cid='.$product['categories_id'].'&pid='.$product['products_id']).'&action=edit_product" onclick="return hs.htmlExpand(this, { objectType: \'iframe\', width: 910, height: 500} )" class="admin_menu_edit">Add</a> <a href="'.mslib_fe::typolink(',2002','&tx_multishop_pi1[page_section]=admin_ajax&cid='.$product['categories_id'].'&pid='.$product['products_id']).'&action=delete_product" onclick="return hs.htmlExpand(this, { objectType: \'iframe\', width: 910, height: 140} )" class="admin_menu_remove" alt="Remove"></a></div>';
}
*/

$counter=0;
$li_type='even';

foreach ($products as $product)
{
if (!$li_type or $li_type=='even') $li_type='odd';
else $li_type='even';
$where='';
if ($product['categories_id'])
{
// get all cats to generate multilevel fake url
$level=0;
$cats=mslib_fe::Crumbar($product['categories_id']);
$cats=array_reverse($cats);
$where='';
if (count($cats) > 0)
{
foreach ($cats as $cat)
{
$where.="categories_id[".$level."]=".$cat['id']."&";
$level++;
}
$where=substr($where,0,(strlen($where)-1));
$where.='&';
}
// get all cats to generate multilevel fake url eof
}

//YBC: Bestandsanzeige mit Ampelsystem-Images
if ($ms['MODULES']['SHOW_STOCK_LEVEL_AS_BOOLEAN'] != 'no')
{
switch ($ms['MODULES']['SHOW_STOCK_LEVEL_AS_BOOLEAN'])
{
case 'yes_with_image':
//YBC: Wenn Produkt-Bestand > 0, dann grĂ¼ne Ampel, sonst rote Ampel und Mengen-/Warenkorb weg
if ($product['products_quantity'] > 0) {
$product['products_quantity']='<img src="'.t3lib_extMgm::siteRelPath($this->extKey).'templates/images/icons/status_green.png" alt="'.htmlspecialchars($this->pi_getLL('in_stock')).'" title="'.htmlspecialchars($this->pi_getLL('in_stock')).'">';
$qtydisplay = "style=\"display:block\"";;
} else {
$product['products_quantity']='<img src="'.t3lib_extMgm::siteRelPath($this->extKey).'templates/images/icons/status_red.png" alt="'.htmlspecialchars($this->pi_getLL('not_in_stock')).'" title="'.htmlspecialchars($this->pi_getLL('not_in_stock')).'">';
$qtydisplay = "style=\"display:none\"";
}
break;
case 'yes_without_image':
if ($product['products_quantity']) $product['products_quantity']=$this->pi_getLL('admin_yes');
else $product['products_quantity']=$this->pi_getLL('admin_no');
break;
}
}


if ($product['products_url']) $link=$product['products_url'];
else $link=mslib_fe::typolink($this->shop_pid,'&'.$where.'&products_id='.$product['products_id'].'&tx_multishop_pi1[page_section]=products_listing');
if (mslib_fe:icon_razz.gifroductHasAttributes($product['products_id'])){
$button_submit = '<a href="'.$link.'" class="ajax_link"><input name="Submit" type="submit" value="'. $this->pi_getLL('checkout') .'"/></a>';
} else {
//$button_submit = '<input type="text" value="1" id="quantity" size="5" name="quantity">&nbsp;';
//YBC: Beibehalten des Mengeneingabe-Wertes
$button_submit = '<input type="text" ' .$qtydisplay. 'id="quantity" size="5" name="quantity" value="';
$qty = $_POST['quantity'];
$qty2 = $_REQUEST['quantity'];
$button_submit .= $qty2;
$button_submit .= '" >&nbsp;';
//$button_submit .= '<input name="Submit" type="submit" value="'. $this->pi_getLL('checkout') .'"/>';
$button_submit .= '<input name="products_id" id="products_id" type="hidden" value="'.$product['products_id'].'" /><input id="multishop_add_to_cart" ' .$qtydisplay. 'name="Submit" type="submit" value="Add to cart"/>';

//YBC: POST-Variablen debuggen
//echo '<pre>';
//print_r($_POST);
//var_dump($_POST);
}

$catlink=mslib_fe::typolink($this->shop_pid,'&'.$where.'&tx_multishop_pi1[page_section]=products_listing');
$counter++;
if ($product['products_image']) $image='<img src="'.mslib_befe::getImagePath($product['products_image'],'products',$this->imageWidth).'" alt="'.htmlspecialchars($product['products_name']).'">';
else $image='<div class="no_image"></div>';

$content.='<li id="productlisting_'. $product['products_id'] .'" class="'.$li_type.'">
<form action="'.mslib_fe::typolink($this->shop_pid,'&tx_multishop_pi1[page_section]=shopping_cart&products_id='.$product['products_id']).'" method="post">
<div class="image"><a href="'.$link.'" title="'.htmlspecialchars($product['products_name']).'" class="ajax_link">'.$image.'</a></div>
<div class="description">'.$product['products_shortdescription'].'</div>
<div class="prodname"><h2>'.$product['products_name'].'</h2></div>
<div class="category">'.$product['products_model'].'</div>
<div class="stock">'.$product['products_quantity'].'</div>
<div class="link_detail"><a href="'.$link.'" class="ajax_link"></a></div>
<div class="hidden_field">
<!-- <input type="hidden" name="quantity" value="" /> -->
<input type="hidden" name="quantity" value="'.$qty2.'" />
<input type="hidden" name="products_id" value="'.$product['qty'].'" />
</div>
<div class="chart_link">'.$button_submit.'</div>
';
$content.='</form></li>';

}

$content.='</ul><br />';

$content.='
<div id="bottom-navigation"><a href="'.mslib_fe::typolink($this->shop_pid,'').'" class="proceed_to_shop">'.$this->pi_getLL('go_to_catalog').'</a>
<div class="cart">
<a href="'.mslib_fe::typolink($this->conf['checkout_page_pid'],'&tx_multishop_pi1[page_section]=checkout').'" class="proceed_to_checkout_button_en">'.$this->pi_getLL('proceed_to_checkout').'</a>
</div>
</div>
<script>
jQuery(document).ready(function($){
$("#shopping_cart_form input"icon_wink.gif.change(function(){
if ($(this).attr("id"icon_wink.gif !=\'coupons_code\')
{
$("#shopping_cart_form"icon_wink.gif.submit();
}
})
});
</script>
';

if ($ms['page'] <> 'products_search' and ($this->ROOTADMIN_USER or ($this->ADMIN_USER and $this->CATALOGADMIN_USER)))
{
$content.='
<script>
jQuery(document).ready(function($) {
var result = jQuery("#product_listing"icon_wink.gif.sortable({
cursor: "move",
//axis: "y",
update: function(e, ui) {
href = "'.mslib_fe::typolink(',2002','&tx_multishop_pi1[page_section]=product&catid='.$product['categories_id']).'";
jQuery(this).sortable("refresh"icon_wink.gif;
sorted = jQuery(this).sortable("serialize", "id"icon_wink.gif;
jQuery.ajax({
type: "POST",
url: href,
data: sorted,
success: function(msg) {
//do something with the sorted data
}
});
}

});
});
</script>
';
}
?>
[/code]
Written on: 12. 07. 2013 [11:55]