Annotation of /com_supacart/trunk/admin_files/html/product.specialprod.php
Parent Directory
|
Revision Log
Revision 4 - (view) (download)
| 1 : | andphe | 4 | <?php |
| 2 : | defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); | ||
| 3 : | /** | ||
| 4 : | * | ||
| 5 : | * @version $Id: product.specialprod.php 617 2007-01-04 19:43:08Z soeren_nb $ | ||
| 6 : | * @package SupaCart | ||
| 7 : | * @subpackage html | ||
| 8 : | * See COPYRIGHT.php for copyright notices and details. | ||
| 9 : | * @license GNU/GPL Version 2, see LICENSE.php | ||
| 10 : | * SupaCart is free software, originally derived from Virtuemart. This version may have been modified pursuant | ||
| 11 : | * to the GNU General Public License, and as distributed it includes or | ||
| 12 : | * is derivative of works licensed under the GNU General Public License or | ||
| 13 : | * other free or open source software licenses. | ||
| 14 : | * See /administrator/components/com_supacart/COPYRIGHT.php for copyright notices and details. | ||
| 15 : | * | ||
| 16 : | * http://www.supacart.com | ||
| 17 : | */ | ||
| 18 : | |||
| 19 : | /** | ||
| 20 : | ---------------------------------------------------------------------- | ||
| 21 : | Special Products Manager | ||
| 22 : | ---------------------------------------------------------------------- | ||
| 23 : | Module designed by | ||
| 24 : | W: www.mrphp.com.au | ||
| 25 : | E: info@mrphp.com.au | ||
| 26 : | P: +61 418 436 690 | ||
| 27 : | ---------------------------------------------------------------------- | ||
| 28 : | */ | ||
| 29 : | mm_showMyFileName( __FILE__ ); | ||
| 30 : | |||
| 31 : | require_once( CLASSPATH . "pageNavigation.class.php" ); | ||
| 32 : | require_once( CLASSPATH . "htmlTools.class.php" ); | ||
| 33 : | |||
| 34 : | $category_id = mosGetParam( $_REQUEST, 'category_id' ); | ||
| 35 : | $filter = mosgetparam($_REQUEST, 'filter', "featured_and_discounted" ); | ||
| 36 : | |||
| 37 : | $qfilter = " AND (product_special='Y' OR product_discount_id > 0) "; | ||
| 38 : | |||
| 39 : | switch( $filter ) { | ||
| 40 : | case "all": | ||
| 41 : | $qfilter = ""; | ||
| 42 : | break; | ||
| 43 : | case "featured": | ||
| 44 : | $qfilter = " AND (product_special='Y') "; | ||
| 45 : | break; | ||
| 46 : | case "discounted": | ||
| 47 : | $qfilter = " AND (product_discount_id > 0) "; | ||
| 48 : | break; | ||
| 49 : | case "featured_and_discounted": | ||
| 50 : | $qfilter = " AND (product_special='Y' OR product_discount_id > 0) "; | ||
| 51 : | break; | ||
| 52 : | } | ||
| 53 : | // Check to see if this is a search or a browse by category | ||
| 54 : | // Default is to show all products | ||
| 55 : | if (!empty( $category_id )) { | ||
| 56 : | $list = "SELECT * FROM #__{sc}_product, #__{sc}_product_category_xref WHERE "; | ||
| 57 : | $count = "SELECT count(*) as num_rows FROM #__{sc}_product, | ||
| 58 : | product_category_xref, category WHERE "; | ||
| 59 : | //$q = "product.vendor_id = '$ps_vendor_id' "; | ||
| 60 : | $q = "#__{sc}_product_category_xref.category_id='$category_id' "; | ||
| 61 : | $q .= "AND #__{sc}_product.product_id=#__{sc}_product_category_xref.product_id "; | ||
| 62 : | $q .= $qfilter; | ||
| 63 : | $q .= "ORDER BY product_name "; | ||
| 64 : | $list .= $q . " LIMIT $limitstart, $limit"; | ||
| 65 : | $count .= $q; | ||
| 66 : | } | ||
| 67 : | elseif (!empty($keyword)) { | ||
| 68 : | $list = "SELECT * FROM #__{sc}_product WHERE "; | ||
| 69 : | $count = "SELECT count(*) as num_rows FROM #__{sc}_product WHERE "; | ||
| 70 : | //$q = "product.vendor_id = '$ps_vendor_id' "; | ||
| 71 : | $q = "(#__{sc}_product.product_name LIKE '%$keyword%' OR "; | ||
| 72 : | $q .= "#__{sc}_product.product_sku LIKE '%$keyword%' OR "; | ||
| 73 : | $q .= "#__{sc}_product.product_s_desc LIKE '%$keyword%' OR "; | ||
| 74 : | $q .= "#__{sc}_product.product_desc LIKE '%$keyword%'"; | ||
| 75 : | $q .= ") "; | ||
| 76 : | $q .= $qfilter; | ||
| 77 : | $q .= "ORDER BY product_name "; | ||
| 78 : | $list .= $q . " LIMIT $limitstart, $limit"; | ||
| 79 : | $count .= $q; | ||
| 80 : | } | ||
| 81 : | else { | ||
| 82 : | $list = "SELECT * FROM #__{sc}_product "; | ||
| 83 : | $count = "SELECT count(*) as num_rows FROM #__{sc}_product "; | ||
| 84 : | $q = "WHERE 1=1 "; | ||
| 85 : | $q .= $qfilter; | ||
| 86 : | $q .= "ORDER BY product_name "; | ||
| 87 : | $list .= $q . " LIMIT $limitstart, $limit"; | ||
| 88 : | $count .= $q; | ||
| 89 : | } | ||
| 90 : | $db->query($count); | ||
| 91 : | |||
| 92 : | $db->next_record(); | ||
| 93 : | $num_rows = $db->f("num_rows"); | ||
| 94 : | |||
| 95 : | // Create the Page Navigation | ||
| 96 : | $pageNav = new vmPageNav( $num_rows, $limitstart, $limit ); | ||
| 97 : | |||
| 98 : | // Create the List Object with page navigation | ||
| 99 : | $listObj = new listFactory( $pageNav ); | ||
| 100 : | |||
| 101 : | // print out the search field and a list heading | ||
| 102 : | $listObj->writeSearchHeader($VM_LANG->_('_PHPSHOP_FEATURED_PRODUCTS_LIST_LBL'), IMAGEURL."ps_image/product_code.png", $modulename, "specialprod"); | ||
| 103 : | |||
| 104 : | echo '<strong>'.$VM_LANG->_PHPSHOP_FILTER.':</strong> '; | ||
| 105 : | if($filter != "all") echo '<a href="'.$sess->url($_SERVER['PHP_SELF']."?page=$page&filter=all").'" title="'.$VM_LANG->_PHPSHOP_LIST_ALL_PRODUCTS.'">'; | ||
| 106 : | echo $VM_LANG->_PHPSHOP_LIST_ALL_PRODUCTS; | ||
| 107 : | if ($filter != 'all') echo '</a>'; | ||
| 108 : | |||
| 109 : | echo ' | '; | ||
| 110 : | if ($filter != 'featured_and_discounted') echo '<a href="'.$sess->url($_SERVER['PHP_SELF']."?page=$page&filter=featured_and_discounted").'" title="'.$VM_LANG->_PHPSHOP_SHOW_FEATURED_AND_DISCOUNTED.'">'; | ||
| 111 : | echo $VM_LANG->_PHPSHOP_SHOW_FEATURED_AND_DISCOUNTED; | ||
| 112 : | if ($filter != 'featured_and_discounted') echo '</a>'; | ||
| 113 : | |||
| 114 : | echo ' | '; | ||
| 115 : | if ($filter != 'featured') echo '<a href="'.$sess->url($_SERVER['PHP_SELF']."?page=$page&filter=featured").'" title="'.$VM_LANG->_PHPSHOP_SHOW_FEATURED.'">'; | ||
| 116 : | echo $VM_LANG->_PHPSHOP_SHOW_FEATURED; | ||
| 117 : | if ($filter != 'featured') echo '</a>'; | ||
| 118 : | |||
| 119 : | echo ' | '; | ||
| 120 : | if ($filter != 'discounted') echo '<a href="'.$sess->url($_SERVER['PHP_SELF']."?page=$page&filter=discounted").'" title="'.$VM_LANG->_PHPSHOP_SHOW_DISCOUNTED.'">'; | ||
| 121 : | echo $VM_LANG->_PHPSHOP_SHOW_DISCOUNTED; | ||
| 122 : | if ($filter != 'discounted') echo '</a>'; | ||
| 123 : | |||
| 124 : | echo '<br /><br />'; | ||
| 125 : | |||
| 126 : | // start the list table | ||
| 127 : | $listObj->startTable(); | ||
| 128 : | |||
| 129 : | // these are the columns in the table | ||
| 130 : | $columns = Array( "#" => "width=\"20\"", | ||
| 131 : | $VM_LANG->_PHPSHOP_PRODUCT_LIST_NAME => '', | ||
| 132 : | $VM_LANG->_PHPSHOP_PRODUCT_LIST_SKU => '', | ||
| 133 : | $VM_LANG->_PHPSHOP_PRODUCT_INVENTORY_PRICE => '', | ||
| 134 : | $VM_LANG->_PHPSHOP_FEATURED => '', | ||
| 135 : | $VM_LANG->_PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT => '', | ||
| 136 : | $VM_LANG->_PHPSHOP_FILEMANAGER_PUBLISHED => '' | ||
| 137 : | ); | ||
| 138 : | $listObj->writeTableHeader( $columns ); | ||
| 139 : | |||
| 140 : | $db->query($list); | ||
| 141 : | |||
| 142 : | $i = 0; | ||
| 143 : | while ($db->next_record()) { | ||
| 144 : | |||
| 145 : | $listObj->newRow(); | ||
| 146 : | |||
| 147 : | // The row number | ||
| 148 : | $listObj->addCell( $pageNav->rowNumber( $i ) ); | ||
| 149 : | |||
| 150 : | $url = $_SERVER['PHP_SELF']."?page=$modulename.product_form&product_id=" . $db->f("product_id"); | ||
| 151 : | if ($db->f("product_parent_id")) { | ||
| 152 : | $url .= "&product_parent_id=" . $db->f("product_parent_id"); | ||
| 153 : | } | ||
| 154 : | $tmp_cell = "<a href=\"" . $sess->url($url) . "\">". $db->f("product_name")."</a>"; | ||
| 155 : | $listObj->addCell( $tmp_cell ); | ||
| 156 : | |||
| 157 : | $listObj->addCell( $db->f("product_sku") ); | ||
| 158 : | |||
| 159 : | $price=$ps_product->get_price($db->f("product_id")); | ||
| 160 : | if ($price) { | ||
| 161 : | if (!empty($price["item"])) { | ||
| 162 : | $tmp_cell = $CURRENCY_DISPLAY->getFullValue( $price["product_price"] ); | ||
| 163 : | } else { | ||
| 164 : | $tmp_cell = "none"; | ||
| 165 : | } | ||
| 166 : | } else { | ||
| 167 : | $tmp_cell = "none"; | ||
| 168 : | } | ||
| 169 : | $listObj->addCell( $tmp_cell ); | ||
| 170 : | |||
| 171 : | $listObj->addCell( vmCommonHTML::getYesNoIcon( $db->f("product_special"), "On Special?" )); | ||
| 172 : | |||
| 173 : | $listObj->addCell( $db->f("product_discount_id") ); | ||
| 174 : | |||
| 175 : | $listObj->addCell( vmCommonHTML::getYesNoIcon( $db->f("product_publish"), "Published?" ) ); | ||
| 176 : | |||
| 177 : | $i++; | ||
| 178 : | } | ||
| 179 : | |||
| 180 : | $listObj->writeTable(); | ||
| 181 : | |||
| 182 : | $listObj->endTable(); | ||
| 183 : | |||
| 184 : | $listObj->writeFooter( $keyword ); | ||
| 185 : | |||
| 186 : | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

