Example #1
0
 /**
  * @var $order array
  * @return array
  */
 public function getComments($order = null)
 {
     $select = $this->allDbAdapter->select();
     $select->from('comments');
     //$select->where('comment_hidden = ?', '0');
     if (isset($order)) {
         $select->order($order);
     } else {
         $select->order(array('comment_product_id', 'comment_order'));
     }
     $comments = $this->allDbAdapter->fetchAll($select->__toString());
     $products = new AdminProducts();
     $array = array();
     foreach ($comments as $comment) {
         $product = $products->getProductById($comment['comment_product_id']);
         if (count($product)) {
             if (isset($array[$product['p_id']])) {
                 $array[$product['p_id']]['comments'][] = $comment;
             } else {
                 $array[$product['p_id']]['name'] = $product['p_title'];
                 $array[$product['p_id']]['id'] = $product['p_id'];
                 $array[$product['p_id']]['comments'][] = $comment;
             }
         } else {
             if (isset($array['others'])) {
                 $array['others']['comments'][] = $comment;
             } else {
                 $array['others']['name'] = 'Comments are not tied to products';
                 $array['others']['class'] = 'hidden';
                 $array['others']['comments'][] = $comment;
             }
         }
     }
     return $array;
 }
 protected function l($string, $class = 'AdminTab', $addslashes = FALSE, $htmlentities = TRUE)
 {
     if ($this->_adminCatalogInstance) {
         return $this->_adminCatalogInstance->exf_l($string, "AdminProducts", $addslashes, $htmlentities);
     }
     return parent::l($string, $class, $addslashes, $htmlentities);
 }
Example #3
0
 public function changelogsaveAction()
 {
     $products = new AdminProducts();
     $data['productId'] = $this->_getParam('pid');
     $string = $this->_getParam('chItem');
     $orders = $this->_getParam('chOrder');
     $id = $this->_getParam('chId');
     if ($this->_hasParam('lang')) {
         $lang = $this->_getParam('lang');
     } else {
         $lang = 1;
     }
     $data['ChLogStrings'][] = array('txt' => $string, 'order' => 0, 'ids' => $id);
     $data['ChLogNum'] = $this->_getParam('ChLogNum');
     $data['buildId'] = $this->_getParam('pbid');
     if ($this->_hasParam('chItemNew')) {
         $data['ChLogStringsNew'] = array_combine($this->_getParam('chOrderNew'), $this->_getParam('chItemNew'));
     }
     $products->saveChangelog($data, $lang);
     $this->_redirect('/products/changelog/id/' . $data['productId'] . '/lang/' . $lang . '/');
 }
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2011 PrestaShop SA
*  @version  Release: $Revision: 6594 $
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
define('PS_ADMIN_DIR', getcwd());
include_once '../config/config.inc.php';
include_once 'tabs/AdminCatalog.php';
include_once 'tabs/AdminProducts.php';
include_once 'init.php';
if (Tools::getValue('token') != Tools::getAdminTokenLite('AdminCatalog')) {
    die(1);
}
$catalog = new AdminCatalog();
$adminProducts = new AdminProducts();
global $cookie;
echo '			<tr>
						<td class="col-left"><label for="id_category_default" class="t">' . $adminProducts->getL('Default category:') . '</label></td>
						<td>
							<select id="id_category_default" name="id_category_default" onchange="checkDefaultCategory(this.value);">';
$categories = Category::getCategories((int) $cookie->id_lang, false);
Category::recurseCategory($categories, $categories[0][1], 1, (int) Tools::getValue('id_category_default'));
echo '			</select>
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $adminProducts->getL('Catalog:') . '</td>
						<td>
							<div style="overflow: auto; min-height: 300px; padding-top: 0.6em;" id="categoryList">
								<script type="text/javascript">
Example #5
0
 public function builderAction()
 {
     include_once 'models/plimusLinksBuilder.php';
     $linksBuilder = new PurchaseLinksBuilder();
     $products = new AdminProducts();
     if ($this->_request->isPost()) {
         if (!$this->_request->getPost('address') || $linksBuilder->checkAddress($this->_request->getPost('address'))) {
             $this->tplVars['builder']['errors']['address'] = true;
         }
         if (!isset($this->tplVars['builder']['errors'])) {
             $licenses = array();
             //foreach($this->_request->getPost('licenses') AS $licenseId) {
             //$licenses[$licenseId] = $this->_request->getPost('license_qnt_'.$licenseId);
             $licenses = $this->_request->getPost('license_qnt');
             //}
             $linksBuilder->addLink($this->_request->getPost('address'), $licenses, $this->_request->getPost('currency'), $this->_request->getPost('coupon'), $this->_request->getPost('backup_cd'), $this->_request->getPost('lifetime_upgrades'), $this->_request->getPost('priority_email_support'), $this->_request->getPost('premium_tech_support'), $this->_request->getPost('premium_tech_support_price'), $this->_request->getPost('language'), $this->_request->getPost('theme'));
         } else {
             $this->tplVars['builder']['val']['address'] = $this->_request->getPost('address');
             $this->tplVars['builder']['val']['currency'] = $this->_request->getPost('currency');
             $this->tplVars['builder']['val']['coupon'] = $this->_request->getPost('coupon');
             $this->tplVars['builder']['val']['backup_cd'] = $this->_request->getPost('backup_cd');
             $this->tplVars['builder']['val']['lifetime_upgrades'] = $this->_request->getPost('lifetime_upgrades');
             $this->tplVars['builder']['val']['priority_email_support'] = $this->_request->getPost('priority_email_support');
             $this->tplVars['builder']['val']['premium_tech_support'] = $this->_request->getPost('premium_tech_support');
             $this->tplVars['builder']['val']['language'] = $this->_request->getPost('language');
             $this->tplVars['builder']['val']['theme'] = $this->_request->getPost('theme');
         }
     }
     $this->tplVars['builder']['couponsList'] = $this->purchaseHandler->getCoupons(-1, -1);
     // ��� ���������
     $this->tplVars['builder']['currenciesList'] = $this->purchaseHandler->getCurrenciesRatios(true);
     $this->tplVars['builder']['licensesList'] = $this->purchaseHandler->getLicenses2ProductsList();
     $this->tplVars['builder']['productsList'] = $products->getProducts();
     $this->tplVars['builder']['linksList'] = $linksBuilder->getLinks();
     array_push($this->viewIncludes, 'purchase/builder.tpl');
     array_push($this->viewIncludes, 'purchase/builderLinksList.tpl');
 }
Example #6
0
 public function addAction()
 {
     if ($this->tplVars['lvals']['canEdit']) {
         include_once 'support.php';
         if ($this->_request->getPost('ispost')) {
             $support = new Support();
             $this->tplVars['support'] = $this->_request->getPost();
             if (($this->tplVars['lvals']['postRes'] = $support->add($this->_request->getPost())) > 0) {
                 $this->_redirect('support/');
             }
             $select_prods = $this->_request->getPost('products_support');
             foreach ($select_prods as $val) {
                 $select[$val] = $val;
             }
         }
         $products = new AdminProducts();
         $prods = $products->getProducts();
         foreach ($prods['prods'] as $cat => $prod) {
             foreach ($prod as $key => $val) {
                 $prods['prods'][$cat][$key]['select'] = $select[$key] ? 1 : 0;
             }
         }
         $this->tplVars['products'] = $prods;
         array_push($this->tplVars['page_css'], 'product_edit.css');
         array_push($this->tplVars['page_css'], 'livevalidation.css');
         array_push($this->tplVars['page_js'], 'livevalidation.js');
         $this->tplVars['lvals']['isNewRecord'] = true;
         array_push($this->viewIncludes, 'support/Edit.tpl');
         $this->tplVars['lvals']['postRes'] = 2;
         unset($support);
     } else {
         $this->_redirect('support/');
     }
 }