function getItems(&$params) { global $CURRENCY_DISPLAY, $sess, $mm_action_url, $VM_LANG; $db = new ps_DB; if($rows = $this->getProductSKU( $this->NumberOfProducts, $this->SortMethod, $this->vmcategories, $this->featuredProducts, $this->specific_product_ids, $this->source, $this->catfilter )) { $ps_product = new ps_product; $ps_product_category = new ps_product_category; $pro_skus = implode("','", $rows); $limit = $this->NumberOfProducts; if($limit>0) { $limit = "LIMIT $limit"; } else { $limit = ""; } $q = "SELECT product_id, product_name, product_parent_id, product_thumb_image, product_desc, product_full_image FROM #__{vm}_product AS p WHERE product_sku in ('$pro_skus')"; switch( $this->SortMethod ) { case 'random': $q .= "\n ORDER BY RAND() $limit"; break; case 'newest': $q .= "\n ORDER BY p.cdate DESC $limit"; break; case 'oldest': $q .= "\n ORDER BY p.cdate ASC $limit"; break; default: $q .= "\n ORDER BY p.cdate DESC $limit"; break; } $db->setQuery( $q ); $items = $db->loadObjectList(); //var_dump($items);die; foreach($items as &$item) { $product_id = $item->product_id; $cid = $ps_product_category->get_cid( $product_id ); $product_name = $item->product_name; $item->title = $product_name; if ($item->product_parent_id) { $url = "?page=shop.product_details&category_id=$cid&flypage=".$ps_product->get_flypage($item->product_parent_id); $url .= "&product_id=" . $item->product_parent_id; } else { $url = "?page=shop.product_details&category_id=$cid&flypage=".$ps_product->get_flypage($item->product_id); $url .= "&product_id=" . $item->product_id; } $product_link = $sess->url($mm_action_url. "index.php" . $url); $item->link = $product_link; $product_thumb_image = $item->product_full_image; //$img = $this->image_url( $product_thumb_image, "alt=\"".$product_name."\""); $item->image = IMAGEPATH.'product/'.$product_thumb_image; $item->fulltext = $item->product_desc; $item->introtext = $item->product_desc; $price_base = $this->get_price($ps_product, $item->product_id); $price_ps = $ps_product->get_price($item->product_id, true); if (_SHOW_PRICES == '1' && $this->show_price) { // Show price, but without "including X% tax" $item->price = $CURRENCY_DISPLAY->getFullValue($price_base[1]); } if (USE_AS_CATALOGUE != 1 && $this->show_addtocart && isset($price_ps) && $price_ps['product_price'] // Product must have a price to add it to cart /*&& !$ps_product->product_has_attributes($item->product_id, true) // Parent Products and Products with attributes can't be added to cart this way*/ ) { $url = "?page=shop.cart&func=cartAdd&product_id=" . $item->product_id; $addtocart_link = $sess->url($mm_action_url. "index.php" . $url); $item->addtocart_link = $addtocart_link; } } return $this->update($params, $items); } else return array(); }
/** * This function allows you to get an object list of user fields * * @param string $section The section the fields belong to (e.g. 'registration' or 'account') * @param boolean $required_only * @param mixed $sys When left empty, doesn't filter by sys * @return array */ function getUserFields($section = 'registration', $required_only = false, $sys = '', $exclude_delimiters = false, $exclude_skipfields = false) { $db = new ps_DB(); $q = "SELECT f.* FROM `#__{vm}_userfield` f" . "\n WHERE f.published=1"; if ($section != 'bank' && $section != '') { $q .= "\n AND f.`{$section}`=1"; } elseif ($section == 'bank') { $q .= "\n AND f.name LIKE '%bank%'"; } if ($exclude_delimiters) { $q .= "\n AND f.type != 'delimiter' "; } if ($required_only) { $q .= "\n AND f.required=1"; } if ($sys !== '') { if ($sys == '1') { $q .= "\n AND f.sys=1"; } elseif ($sys == '0') { $q .= "\n AND f.sys=0"; } } if ($exclude_skipfields) { $q .= "\n AND FIND_IN_SET( f.name, '" . implode(',', ps_userfield::getSkipFields()) . "') = 0 "; } $q .= "\n ORDER BY f.ordering"; $db->setQuery($q); $userFields = $db->loadObjectList(); return $userFields; }
<input type="hidden" name="page" value="order.sc_change_shipping"> <input type="hidden" name="fn" value="showallbutton"> <input type="hidden" name="option" value="com_virtuemart"> <input type="hidden" value="<?php echo $db->f("order_id"); ?> " name="order_id"> </form> <?php } ?> <?php $dblog = new ps_DB(); $q = "SELECT * FROM order_log WHERE order_id='{$order_id}' ORDER BY id DESC"; $dblog->query($q); $log_list = $dblog->loadObjectList(); ?> <br> <button style="width: 145px;" class="btn getallbuttons" onclick="toggleLogs();">Показать логи</button> <table style="display: none;" id="form_logs" class="adminlist" border="1"> <tr> <th style="text-align: center;">Категория события</th> <th style="text-align: center;">Наименование</th> <th style="text-align: center;">Старое значение</th> <th style="text-align: center;">Новое значение</th> <th style="text-align: center;">Идентификатор пользователя</th> <th style="text-align: center;">Время изменения</th> </tr> <?php foreach ($log_list as $arr) { ?>
function recalcorder($order_id, $r) { $db = new ps_DB(); $query = "SELECT * FROM #__{vm}_orders"; $db->Query($query); $list = $db->loadObjectList(); if ($db->getErrorNum()) { echo $db->stderr(); return false; } $ps_order = new ps_order($order_id); $ps_order->{$ps_order_change} = new ps_order_change($order_id); $ps_order_change->recalc_order($order_id); }
function getOrderInfo($order_id) { $qv = "SELECT *\n\t\t FROM `#__{vm}_orders` as o\n\t\t left join `#__{vm}_order_user_info` as oi on o.order_id = oi.order_id \n\t\t WHERE o.order_id='" . $order_id . "'"; $db_ap = new ps_DB(); $db_ap->setQuery($qv); $result = $db_ap->loadObjectList(); return $result[0]; }