Ejemplo n.º 1
2
function renderProduct(MESH\Commerce\Products\Product $product)
{
    $vars = array('name' => $product->getName(), 'main' => displayImage($product->getMainImage(), 300, 300), 'images' => array());
    $imgs = array();
    foreach ($product->getImages() as $img) {
        $vars['images'][] = displayImage($img, 125, 125);
    }
    return theme('product', $vars);
}
Ejemplo n.º 2
1
 public function testProductLoad()
 {
     $mock = new Mock([$this->getSampleHttpData('product-sample')]);
     $history = new History();
     $http = $this->getMockConnection();
     $http->getEmitter()->attach($mock);
     $http->getEmitter()->attach($history);
     $product = new MESH\Commerce\Products\Product($this->getMockConfiguration(), $http, '193965');
     $product->load();
     $this->assertEquals('Boss Green Victoire Embossed Trainer', $product->name);
     $last = $history->getLastRequest();
     $this->assertEquals('http://uat-commerce.mesh.mx/stores/scottsmenswear/products/193965?api_key=1234567890ABCDEF1234567890ABCDEF&channel=desktop', $last->getUrl());
 }