Skip to content

Commit

Permalink
Allow adding several products at once by using different basket indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
aimeos committed Oct 2, 2018
1 parent 404a10c commit 5d52064
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions client/html/templates/common/partials/products-standard.php
Expand Up @@ -14,6 +14,7 @@
* - position : Position is product list to start from (optional)
*/

$index = -1;
$enc = $this->encoder();
$position = $this->get( 'position' );
$productItems = $this->get( 'productItems', [] );
Expand Down Expand Up @@ -105,7 +106,7 @@
?>
<ul class="list-items"><!--
<?php foreach( $this->get( 'products', [] ) as $id => $productItem ) : $firstImage = true; ?>
<?php foreach( $this->get( 'products', [] ) as $id => $productItem ) : $firstImage = true; $index++ ?>
<?php
$conf = $productItem->getConfig(); $css = ( isset( $conf['css-class'] ) ? $conf['css-class'] : '' );
$params = array( 'd_name' => $productItem->getName( 'url' ), 'd_prodid' => $id );
Expand Down Expand Up @@ -261,11 +262,11 @@
name="<?= $enc->attr( $this->formparam( 'b_action' ) ); ?>"
/>
<input type="hidden" value="<?= $id; ?>"
name="<?= $enc->attr( $this->formparam( array( 'b_prod', 0, 'prodid' ) ) ); ?>"
name="<?= $enc->attr( $this->formparam( array( 'b_prod', $index, 'prodid' ) ) ); ?>"
/>
<input type="number" class="form-control" value="1"
min="1" max="2147483647" maxlength="10" step="1" required="required" <?= $disabled ?>
name="<?= $enc->attr( $this->formparam( array( 'b_prod', 0, 'quantity' ) ) ); ?>"
name="<?= $enc->attr( $this->formparam( array( 'b_prod', $index, 'quantity' ) ) ); ?>"
/><!--
--><button class="btn btn-primary" type="submit" value="" <?= $disabled ?> >
<?= $enc->html( $this->translate( 'client', 'Add to basket' ), $enc::TRUST ); ?>
Expand Down

0 comments on commit 5d52064

Please sign in to comment.