how to add shopping cart to members tab?

Discussion in 'Templates customization' started by ccwjames, Apr 8, 2016.

  1. ccwjames

    ccwjames Member

    Joined:
    Sep 11, 2014
    Messages:
    430
    i added the cart today for some items i want to sell

    i dont see anywhere in a profile i logged into to see the images and details and only the item at bottom off the product list

    so i thought i make a tab at top for box sales

    i added this to the site php

    Am_Di::getInstance()->hook->add(Am_Event::USER_MENU, function (Am_Event $event) {
    // $user = $event->getUser(); // if required
    $menu = $event->getMenu();
    // Add a single tab
    $menu->addPage(array(
    'id' => 'boxsales',
    'label' => 'Box Sales',
    'uri' => '/cart',
    'order' => 12,
    ));

    but when i go back to screen , all white?
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,659
    It seems this code is incomplete. Do you mind to use this one:
    PHP:
    Am_Di::getInstance()->hook->add(Am_Event::USER_MENU, function (Am_Event $e) {
        
    $e->getMenu()->addPage(array(
                
    'id' => 'boxsales',
                
    'label' => 'Box Sales',
                
    'module' => 'cart',
                
    'controller' => 'index',
                
    'action' => 'index',
                
    'order' => 12
            
    ));
    });
  3. ccwjames

    ccwjames Member

    Joined:
    Sep 11, 2014
    Messages:
    430
    will try right now
  4. ccwjames

    ccwjames Member

    Joined:
    Sep 11, 2014
    Messages:
    430
    seems to be working, i missed the double )); ??
  5. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,659
    Yeah, right. Also I suggest use MVC approach (with module/controller/action) instead of pass URI explicitly.
    In this case your tab will respect active state eg. change its style once user open shopping cart page. I believe it is more user friendly approach.

    Best Regards.

Share This Page