class/class.coupon.php 1 location
|
@@ 267-278 (lines=12) @@
|
| 264 |
|
* @param int $itemid listing id |
| 265 |
|
* @return bool|int |
| 266 |
|
*/ |
| 267 |
|
public function getCountByLink($itemid) |
| 268 |
|
{ |
| 269 |
|
$ret = 0; |
| 270 |
|
$now = time(); |
| 271 |
|
$sql = 'SELECT count(*) FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' WHERE itemid=' . (int)$itemid . ' AND publish < ' . $now . ' AND (expire = 0 OR expire > ' . $now . ')'; |
| 272 |
|
if (!$result = $this->db->query($sql)) { |
| 273 |
|
return false; |
| 274 |
|
} |
| 275 |
|
list($ret) = $this->db->fetchRow($result); |
| 276 |
|
|
| 277 |
|
return $ret; |
| 278 |
|
} |
| 279 |
|
|
| 280 |
|
/** |
| 281 |
|
* get {@link Coupon} object with listing info |
class/class.couponhandler.php 1 location
|
@@ 139-151 (lines=13) @@
|
| 136 |
|
* |
| 137 |
|
* @return |
| 138 |
|
*/ |
| 139 |
|
public function getCountByLink($itemid = 0) |
| 140 |
|
{ |
| 141 |
|
$ret = 0; |
| 142 |
|
$now = time(); |
| 143 |
|
$sql = 'SELECT count(*) FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' WHERE itemid=' . $itemid . ' AND publish < ' . $now . ' AND (expire = 0 OR expire > ' . $now . ')'; |
| 144 |
|
//echo $sql; |
| 145 |
|
if (!$result = $this->db->query($sql)) { |
| 146 |
|
return false; |
| 147 |
|
} |
| 148 |
|
list($ret) = $this->db->fetchRow($result); |
| 149 |
|
|
| 150 |
|
return $ret; |
| 151 |
|
} |
| 152 |
|
|
| 153 |
|
public function getByItem($itemid = 0) |
| 154 |
|
{ |