shopping cart more columns

Discussion in 'Troubleshooting' started by robbyschanilec, Mar 3, 2016.

  1. robbyschanilec

    robbyschanilec New Member

    Joined:
    Feb 9, 2016
    Messages:
    22
    I am looking to add more columns to our shopping cart.. i have added this to the index.phtml from cart/views/cart/

    <?php
    $current = $left = $this->placeholder('product-coll-left');
    $right = $this->placeholder('product-coll-right');
    $left2 = $this->placeholder('product-coll-left');
    $right2 = $this->placeholder('product-coll-right');
    foreach ($products as $product) {
    $current->captureStart();
    include $this->_script('cart/_product.phtml');
    $current->captureEnd();
    //$current = (($current === $left) ? $right : $left);
    switch($current){
    case $left:
    $current = $right;
    break;
    case $right:
    $current = $left2;
    break;
    case $left2:
    $current = $right2;
    break;
    case $right2:
    $current = $left;
    break;
    }
    }
    ?>
    <div class="am-cart-layout-two-coll">
    <div class="am-cart-layout-four-coll-coll am-cart-layout-two-coll-coll-left">
    <div class="am-cart-layout-two-coll-content">
    <?php echo $left ?>
    </div>
    </div>
    <div class="am-cart-layout-four-coll-coll am-cart-layout-two-coll-coll-right">
    <div class="am-cart-layout-two-coll-content">
    <?php echo $right ?>
    </div>
    </div>
    <div class="am-cart-layout-four-coll-coll am-cart-layout-two-coll-coll-left">
    <div class="am-cart-layout-two-coll-content">
    <?php echo $left2 ?>
    </div>
    </div>
    <div class="am-cart-layout-four-coll-coll am-cart-layout-two-coll-coll-right">
    <div class="am-cart-layout-two-coll-content">
    <?php echo $right2 ?>
    </div>
    </div>

    </div>


    I also added this to the cart.css
    .am-cart-layout-four-coll-coll {
    float: left;
    width: 25%;
    }

    but it is not working

    i think the problem is with
    $current = $left = $this->placeholder('product-coll-left');
    $right = $this->placeholder('product-coll-right');
    $left2 = $this->placeholder('product-coll-left');
    $right2 = $this->placeholder('product-coll-right');

    i have tried
    $current = $left = $this->placeholder('product-coll-left');
    $right = $this->placeholder('product-coll-right');
    $left2 = $this->placeholder('product-coll-left2');
    $right2 = $this->placeholder('product-coll-right2');

    but this aslo did not work.

    any help would be great thanks!
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Feel free to use the following layout as example. You can customize it further according your requirements
    PHP:
    <?php
    $title
    $di->config->get('site_title') . ( $category ? (' : ' $category->title) : '');
    $this->setLayout('cart/layout.phtml');
    ?>
    <?php 
    if (count($products)) : ?>
    <?php 
    if (empty($displayProductDetails)) :
    $colls = array(
        
    $this->placeholder('product-coll4'),
        
    $this->placeholder('product-coll3'),
        
    $this->placeholder('product-coll2'),
        
    $this->placeholder('product-coll1')
    );
    foreach (
    $products as $product) {
        
    $current array_pop($colls);
        
    $current->captureStart();
        include 
    $this->_script('cart/_product.phtml');
        
    $current->captureEnd();
        
    array_unshift($colls$current);
    }
    $this->placeholder('products')->captureStart(); ?>
    <div style="overflow:hidden;">
        <div style="float:left; width:25%; padding:5px; box-sizing: border-box">
            <?= $this->placeholder('product-coll1'?></div>  
        <div style="float:left; width:25%; padding:5px; box-sizing: border-box">
            <?= $this->placeholder('product-coll2'?></div>
        <div style="float:left; width:25%; padding:5px; box-sizing: border-box">
            <?= $this->placeholder('product-coll3'?></div>
        <div style="float:left; width:25%; padding:5px; box-sizing: border-box">
            <?= $this->placeholder('product-coll4'?></div>
    </div>
    <?php $this->placeholder('products')->captureEnd(); ?>
    <?php 
    else : ?>
    <?php
    $this
    ->placeholder('products')->captureStart();
    foreach (
    $products as $product)
        include 
    $this->_script('cart/_product.phtml');
    $this->placeholder('products')->captureEnd();
    ?>
    <?php 
    endif; ?>
        <div class="am-cart-layout-one-coll">
            <div class="am-cart-layout-one-coll-coll">
                <div class="am-cart-layout-one-coll-content">
                    <?= $this->placeholder('products'?>
                </div>
            </div>
        </div>
        <?php echo $paginator->render(); ?>
    <?php 
    else: ?>
        <?php __e('Products not found. Click %shere%s to continue shopping.''<a href="' REL_ROOT_URL '/cart">''</a>'?>
    <?php 
    endif; ?>
  3. robbyschanilec

    robbyschanilec New Member

    Joined:
    Feb 9, 2016
    Messages:
    22
    when i first ran it those whole page displayed "placeholder('products')" as plain text so i changed
    <?= $this->placeholder('products') ?> to <?php $this->placeholder('products'); ?>

    but this showed the shopping page again but it didnt show any products
  4. robbyschanilec

    robbyschanilec New Member

    Joined:
    Feb 9, 2016
    Messages:
    22
    although you have <?= $this->placeholder('products') ?> other places on the page. so maybe i dont knwo what i am talking about
  5. robbyschanilec

    robbyschanilec New Member

    Joined:
    Feb 9, 2016
    Messages:
    22
    i figured it out. i had to change it to
    <?php echo $this->placeholder('products'); ?>
    because of short tags turned off.
    caesar likes this.

Share This Page