Your cart
0

Useful code tip

Core function: easyshop($args)
            
                <?php

                    // Get class \ES\Product from JPATH_LIBRARIES/easyshop/classes/product.php
                    $productClass = easyshop('class.product');

                    // Get a product by ID
                    $productId = 1;
                    $product   = $productClass->getItem($productId);

                    if ($product->images)
                    {
                        foreach ($product->images as $image)
                        {
                            // Product Image Sizes: tiny, small, medium, large and xlarge
                            echo '<div><img src="' . $image->medium . '"' alt=""/></div>';
                        }
                    }

                    // Get list images by product ID
                    $images = $productClass->getImages($productId);
                    var_dump($images);
            
        
Cart
            
                <?php
                    // Declare $cartClass
                    $cartClass = easyshop('class.cart');

                    // Get all current data in cart
                    $data = $cartClass->extractData();
                    var_dump($data);

                    // Add an item (product) into cart
                    $productId = 1;
                    $quantity  = 1;
                    $cartClass->addItem($productId, $quantity);

                    // Get an item (product) from current cart
                    $item = $cartClass->getItem($productId);

                    // Remove an item (product) from current cart
                    $item = $cartClass->removeItem($productId);

                    // Destroy cart
                    $cartClass->destroy();
            
        
Currency
            
                <?php
                    // Declare $currencyClass
                    $currencyClass = easyshop('class.currency');

                    // Get current currency OBJECT
                    $currency = $currencyClass->getActive();
                    echo $currency->get('code'); // Eg: USD, EUR, ...

                    // Format currency
                    echo $currency->toFormat(125); // Eg: $125.00, EUR125.00, ...

                    // Convert exchange rate for multi-currency mode
                    // Default currency is: USD, exchange rate = 1 (always)
                    // Front-end active currency is: EURO, exchange rate = 0.8

                    echo '125 USD = ' . $currency->convert(125) . ' EURO'; // 125 USD = 100 EURO
                    
                    // Or use $convert = true argument
                    echo '125 USD = ' . $currency->toFormat(125, true) . ' EURO'; // 125 USD = 100 EURO
            
        
Order
            
                <?php
                    // Declare $orderClass
                    $orderClass = easyshop('class.order');

                    // Load an order ID
                    $orderId = 1;

                    if ($orderClass->load($orderId))
                    {
                        // Order code
                        $code = $orderClass->get('order_code');

                        // Total price
                        $totalPrice = $orderClass->get('total_price');

                        // Customer name
                        $customerName = $orderClass->get('customerName');

                        // Get billing/shipping address
                        // Return ['billing' => BILLING_ADDRESS_FIELDS, 'shipping' => SHIPPING_ADDRESS_FIELDS]
                        $address = $orderClass->getAddress();

                        // Format address to string
                        $utilityClass = easyshop('class.utility');
                        echo 'Billing Address: ' . $utilityClass->formatAddress($address['billing']);
                        echo '<br/>Shipping Address: ' . $utilityClass->formatAddress($address['shipping']);
                    }
            
        

wWw.joomtech.net. All rights reserved.

CONTACT US
  • This email address is being protected from spambots. You need JavaScript enabled to view it.
HIRE US to develop your store.

© 2015 - 2019 wWw.joomtech.net. All rights reserved. JoomTech.net is not affiliated with or endorsed by the Joomla! Project or Open Source Matters. The Joomla!® name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.