function displayProducts() { $soapId = null; $page = 0; $pageSize = 10; $returnCode = '200'; $product = new Product(); $response = $product->fetchAll($page, $pageSize); print_r($response); //print_r($response['data']->products); $return = $response['data']->return; $returnCode = logReturn($return, "TEntitlement: Product.fetchAll result:"); if ('200' != $returnCode) { logEnvironment(); } $soapId = $return->soapId; $products = $response['data']->products; printProducts("Product", $products); return $soapId; }
<?php require_once 'Product.php'; $product = new Product(); $products = $product->fetchAll();
<?php // Include the Vindicia library require_once "../../../API/50/Vindicia/Soap/Vindicia.php"; require_once "../../../API/50/Vindicia/Soap/Const.php"; $product = new Product(); $page = 0; $pageSize = 10; $hasMore = true; $totalProductCount = 0; do { $ret = $product->fetchAll($page, $pageSize); $count = 0; if ($ret['returnCode'] == 200) { $fetchedProducts = $ret['data']->products; if ($fetchedProducts != null) { $count = sizeof($fetchedProducts); print $count . ' products returned on page ' . $page . PHP_EOL; foreach ($fetchedProducts as $prod) { print 'Product Id=' . $prod->merchantProductId . PHP_EOL; print 'Product Description=' . $prod->descriptions[0]->description . PHP_EOL; print 'Default Billing Plan=' . $prod->defaultBillingPlan->merchantBillingPlanId . PHP_EOL; $totalProductCount++; } $page++; } else { print 'No products returned on page ' . $page . PHP_EOL; $hasMore = false; } } else { if ($ret['returnCode'] == 404) {
public function getAction() { $this->file_name = FTP_PATH . "/sitemap"; $c_count = 1000; $Product = new Product(); $Category = new Category(); $i = 0; $Tempval = new Tempval(); $last_update = $Tempval->get('last-update'); $last_update = $last_update['val']; $last_update = $last_update ? $last_update : time() - 24 * 60 * 60; $res = ''; /*$res .= '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';*/ // ------------------- TOYS ------------------------------- $off = 0; do { $toys = $Product->fetchAll(null, null, $c_count, $off)->toArray(); $i += count($toys); $off += $c_count; foreach ($toys as $toy) { $this->make_res(array('loc' => DOMAIN_PATH . '/toy/detail/toy_id/' . $toy['id'], 'lastmod' => date('Y-m-d', $last_update), 'priority' => '0.8')); /* $res .= '<url>'; $res .= '<loc>'.DOMAIN_PATH.'/toy/detail/toy_id/'.$toy['id'].'/</loc>'; $res .= '<lastmod>'.date('Y-m-d',$last_update).'</lastmod>'; $res .= '<changefreq>weekly</changefreq>'; $res .= '<priority>0.8</priority>'; $res .= '</url>'; */ } } while (count($toys) > 0); // ---------------------------------------------------------- // ------------------ CATEGORIES ---------------------------- $off = 0; do { $cats = $Category->fetchAll(null, null, $c_count, $off)->toArray(); $off += $c_count; foreach ($cats as $cat) { $this->make_res(array('loc' => DOMAIN_PATH . '/category/detail-list/cat_id/' . $cat['id'], 'lastmod' => date('Y-m-d', $last_update), 'priority' => '0.5')); /* $res .= '<url>'; $res .= '<loc>'.DOMAIN_PATH.'/category/detail-list/cat_id/'.$cat['id'].'/</loc>'; $res .= '<lastmod>'.date('Y-m-d',$last_update).'</lastmod>'; $res .= '<changefreq>weekly</changefreq>'; $res .= '<priority>0.5</priority>'; $res .= '</url>'; */ } } while (count($cats) > 0); // ---------------------------------------------------------- // ----------- MAIN PAGE ------------------------------------ $this->make_res(array('loc' => DOMAIN_PATH, 'lastmod' => date('Y-m-d', $last_update), 'priority' => '0.9'), true); /* $res .= '<url>'; $res .= '<loc>'.DOMAIN_PATH.'/</loc>'; $res .= '<lastmod>'.date('Y-m-d',$last_update).'</lastmod>'; $res .= '<changefreq>weekly</changefreq>'; $res .= '<priority>0.9</priority>'; $res .= '</url>'; */ // ---------------------------------------------------------- //$res .='</urlset>'; /* $f = fopen(FTP_PATH.'/sitemap.xml','wb'); fwrite($f,$res); fclose($f); */ $this->_helper->viewRenderer->setNoRender(); $this->_helper->layout->disableLayout(); print_r('OK'); }
function adminlistgiftsAction() { $this->_helper->layout->setLayout("layout_admin"); $this->view->activeTab = 'Redeem'; //2011-09-20 ham.bao filter the gift by status if ($this->_request->getParam('status')) { $this->view->status = $this->_request->getParam('status'); if ($this->view->status != 'ALL') { $status = ' state = "' . $this->view->status . '"'; } else { $status = ''; } } else { $this->view->status = "ALL"; $status = ''; } if ($this->_request->getParam('t')) { $this->view->t = $this->_request->getParam('t'); if ($this->view->t != 'ALL') { $t = "category = '" . $this->_request->getParam('t') . "'"; } else { $t = ''; } } else { $this->view->t = 'ALL'; $t = ''; } if ($this->_request->getParam('p1')) { $this->view->p1 = $this->_request->getParam('p1'); } else { $this->view->p1 = 0; $p1 = ''; } if ($this->_request->getParam('p2')) { $this->view->p2 = $this->_request->getParam('p2'); if ($this->view->p2 != 0) { $p2 = 'point >= ' . $this->_request->getParam('p1') . ' and point <= ' . $this->_request->getParam('p2'); } else { $p2 = ''; } } else { $this->view->p2 = 0; $p2 = ''; } $where = ''; if ($status != '') { $where = ' and ' . $status; } if ($t != '') { $where .= ' and ' . $t; } if ($p2 != '') { $where .= ' and ' . $p2; } $productModel = new Product(); $this->view->products = $productModel->fetchAll('state != "EXPIRED" ' . $where, 'id')->toArray(); //2011-09-20 ham.bao filter the gift by status // $productModel = new Product(); // //// if($this->_request->getParam('t') != null && $this->_request->getParam('t') == 'mine'){ //// $db = Zend_Registry::get('db'); ////// $selectAmountPoint = $db->select(); ////// $selectAmountPoint->from('reward_point_transaction_record', 'SUM(point_amount)') ////// ->where("consumer_id = ?", $this->_currentUser->id); //// $today = date("Y-m-d" , time()); //// $amountPoints = $db->fetchOne( //// "SELECT sum(point_amount) FROM reward_point_transaction_record WHERE (consumer_id = :temp and date <:temp2) or (consumer_id = :temp and date >=:temp2 and transaction_id=4) ", //// array('temp' =>$this->_currentUser->id,'temp2'=>date("Y-m-d",strtotime("$today -30 day")))); //// $this->view->products = $productModel->fetchAll(' point <= '.$amountPoints . $status, 'point desc')->toArray(); //// }else{ //// if($this->_request->getParam('p2') != null && (int)$this->_request->getParam('p2') > 0){ //// $this->view->products = $productModel->fetchAll('point >= '.$this->_request->getParam('p1').' and point < '.$this->_request->getParam('p2') . $status, 'point')->toArray(); //// }else{ //// if($this->_request->getParam('t') != null && $this->_request->getParam('t') != 'none'){ //// $this->view->products = $productModel->fetchAll("category = '".$this->_request->getParam('t')."'" . $status, 'point')->toArray(); //// }else{ //// $this->view->products = $productModel->fetchAll('state != "EXPIRED" ' . $status, 'id')->toArray(); //// } //// } //// } // $this->view->fc = Zend_Controller_Front::getInstance(); // Zend_Debug::dump($this->view->products); }