forked from pikusov/Simpla
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
6,923 additions
and
7,241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,35 @@ | ||
<?php | ||
session_start(); | ||
require_once('../api/Simpla.php'); | ||
|
||
class CartAjax extends Simpla | ||
{ | ||
public function fetch() | ||
{ | ||
$this->cart->add_item($this->request->get('variant', 'integer'), $this->request->get('amount', 'integer')); | ||
$cart = $this->cart->get_cart(); | ||
$this->design->assign('cart', $cart); | ||
|
||
$currencies = $this->money->get_currencies(array('enabled'=>1)); | ||
if(isset($_SESSION['currency_id'])) | ||
$currency = $this->money->get_currency($_SESSION['currency_id']); | ||
else | ||
$currency = reset($currencies); | ||
|
||
$this->design->assign('currency', $currency); | ||
|
||
return $this->design->fetch('cart_informer.tpl'); | ||
} | ||
} | ||
|
||
$cart_ajax = new CartAjax(); | ||
$result = $cart_ajax->fetch(); | ||
|
||
header("Content-type: application/json; charset=UTF-8"); | ||
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); | ||
header("X-Robots-Tag: noindex"); | ||
header("Pragma: no-cache"); | ||
header("Expires: -1"); | ||
print json_encode($result); | ||
exit; | ||
<?php | ||
session_start(); | ||
require_once('../api/Simpla.php'); | ||
|
||
class CartAjax extends Simpla | ||
{ | ||
public function fetch() | ||
{ | ||
$this->cart->add_item($this->request->get('variant', 'integer'), $this->request->get('amount', 'integer')); | ||
$cart = $this->cart->get_cart(); | ||
$this->design->assign('cart', $cart); | ||
|
||
$currencies = $this->money->get_currencies(array('enabled'=>1)); | ||
if (isset($_SESSION['currency_id'])) { | ||
$currency = $this->money->get_currency($_SESSION['currency_id']); | ||
} else { | ||
$currency = reset($currencies); | ||
} | ||
|
||
$this->design->assign('currency', $currency); | ||
|
||
return $this->design->fetch('cart_informer.tpl'); | ||
} | ||
} | ||
|
||
$cart_ajax = new CartAjax(); | ||
$result = $cart_ajax->fetch(); | ||
|
||
header("Content-type: application/json; charset=UTF-8"); | ||
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); | ||
header("X-Robots-Tag: noindex"); | ||
header("Pragma: no-cache"); | ||
header("Expires: -1"); | ||
print json_encode($result); | ||
exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,54 @@ | ||
<?php | ||
require_once('../api/Simpla.php'); | ||
|
||
class SearchProductsAjax extends Simpla | ||
{ | ||
private $limit = 30; | ||
public function fetch() | ||
{ | ||
$result = new stdClass; | ||
$result->suggestions = array(); | ||
$result->query = $this->request->get('query', 'string'); | ||
|
||
if(!empty($result->query)) | ||
{ | ||
$kw = $this->db->escape($result->query); | ||
|
||
$this->db->query("SELECT p.id, p.name, i.filename as image FROM __products p | ||
LEFT JOIN __images i ON i.product_id=p.id AND i.position=(SELECT MIN(position) FROM __images WHERE product_id=p.id LIMIT 1) | ||
WHERE (p.name LIKE '%$kw%' OR p.meta_keywords LIKE '%$kw%' OR p.id in (SELECT product_id FROM __variants WHERE sku LIKE '%$kw%')) | ||
AND visible=1 | ||
GROUP BY p.id | ||
ORDER BY p.name | ||
LIMIT ?", $this->limit); | ||
$products = $this->db->results(); | ||
|
||
$suggestions = array(); | ||
|
||
foreach($products as $product) | ||
{ | ||
$suggestion = new stdClass(); | ||
|
||
if(!empty($product->image)) | ||
$product->image = $this->design->resize_modifier($product->image, 35, 35); | ||
|
||
$suggestion->value = $product->name; | ||
$suggestion->data = $product; | ||
$result->suggestions[] = $suggestion; | ||
} | ||
} | ||
|
||
|
||
return $result; | ||
} | ||
} | ||
|
||
$cart_ajax = new SearchProductsAjax(); | ||
$result = $cart_ajax->fetch(); | ||
|
||
header("Content-type: application/json; charset=UTF-8"); | ||
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); | ||
header("X-Robots-Tag: noindex, noarchive, nosnippet"); | ||
header("Pragma: no-cache"); | ||
header("Expires: -1"); | ||
print json_encode($result); | ||
exit; | ||
<?php | ||
require_once('../api/Simpla.php'); | ||
|
||
class SearchProductsAjax extends Simpla | ||
{ | ||
private $limit = 30; | ||
public function fetch() | ||
{ | ||
$result = new stdClass; | ||
$result->suggestions = array(); | ||
$result->query = $this->request->get('query', 'string'); | ||
|
||
if (!empty($result->query)) { | ||
$kw = $this->db->escape($result->query); | ||
|
||
$this->db->query("SELECT p.id, p.name, i.filename as image FROM __products p | ||
LEFT JOIN __images i ON i.product_id=p.id AND i.position=(SELECT MIN(position) FROM __images WHERE product_id=p.id LIMIT 1) | ||
WHERE (p.name LIKE '%$kw%' OR p.meta_keywords LIKE '%$kw%' OR p.id in (SELECT product_id FROM __variants WHERE sku LIKE '%$kw%')) | ||
AND visible=1 | ||
GROUP BY p.id | ||
ORDER BY p.name | ||
LIMIT ?", $this->limit); | ||
$products = $this->db->results(); | ||
|
||
$suggestions = array(); | ||
|
||
foreach ($products as $product) { | ||
$suggestion = new stdClass(); | ||
|
||
if (!empty($product->image)) { | ||
$product->image = $this->design->resize_modifier($product->image, 35, 35); | ||
} | ||
|
||
$suggestion->value = $product->name; | ||
$suggestion->data = $product; | ||
$result->suggestions[] = $suggestion; | ||
} | ||
} | ||
|
||
|
||
return $result; | ||
} | ||
} | ||
|
||
$cart_ajax = new SearchProductsAjax(); | ||
$result = $cart_ajax->fetch(); | ||
|
||
header("Content-type: application/json; charset=UTF-8"); | ||
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); | ||
header("X-Robots-Tag: noindex, noarchive, nosnippet"); | ||
header("Pragma: no-cache"); | ||
header("Expires: -1"); | ||
print json_encode($result); | ||
exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.