CREATE INDEX visitorhistory_store_created_at_index ON visitorhistory (store, created_at);
The reference use: https://blog.nodeswat.com/making-slow-queries-fast-with-composite-indexes-in-mysql-eb452a8d6e46
Shopify, Shopify Apps, Magento, WordPress, Codeigniter, Joomla, Big Commerce | PHP
CREATE INDEX visitorhistory_store_created_at_index ON visitorhistory (store, created_at);
jQuery(function () {
jQuery('body').find(".couponproduct .gf_add-to-cart").click(function (e) {
e.preventDefault();
values = {}
values[30370850865245] = 0;
values[31289364840541] = 1;
jQuery.ajax({
type: 'POST',
url: '/cart/update.js',
data: { updates: values},
dataType: 'json',
success: function() {
location.href = '/checkout';
}
});
});
});
<div class="main-chaty-popup-bg"></div>
<div class="main-chaty-popup">
<div class="main-chaty-box">
<h4>Chaty is currently off</h4>
<div class="popup-content">
<div class="popup-content-wrapper"> Chaty is currently turned off, would you like to save and show it on your site? </div>
</div>
<div class="popup-content-footer">
<button type="button" class="btn btn-primary">Yes, Show it on my site</button>
<button type="button" class="btn btn-default">Just save and keep it off</button>
</div>
<div class="modul-close-btn">
<a href="#"> X </a>
</div>
</div>
</div>
<style type="text/css">
.main-chaty-popup-bg {position: fixed;left: 0;top: 0;width: 100%;height: 100%;overflow: auto;background-color: #000; opacity: 0.5;z-index: 111;}
.main-chaty-popup {margin:0;width: 100%;text-align: center;z-index: 1;}
.main-chaty-box {margin: auto; padding: 0px; width: 660px; height: 170px; background: #FFF; position: fixed; top: 0; right: 0; left: 0; bottom: 0;z-index: 999;}
.main-chaty-box h4 {background: #FCFCFC; margin: 0;padding: 10px 0 10px 10px;font-size: 22px;color: #626262;line-height: 22px;text-align: left;border-bottom: 1px solid #e5e5e5;}
.modul-close-btn {position: absolute; right: 18px; top: 20px; transform: translate(50%, -50%); background: linear-gradient(0deg, #333, #333), linear-gradient(153.18deg, #6371DB 7.07%, #FF89C4 90.47%); border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center;justify-content: center;padding: 0; border: 0; z-index: 1; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); cursor: pointer;}
.popup-content-footer{position: absolute;bottom: 0; width: 100%; padding: 10px 0;border-top: 1px solid #e5e5e5;}
.popup-content-footer .btn-primary{background:#00C67C;border: none;padding: 10px;color: #FFF;cursor: pointer;box-shadow: 1px 1px 2px 1px #000;border-radius: 5px;margin-right: 15px;}
.popup-content-footer .btn-default{background:#F7F7F7;border: none;padding: 10px;color: #655d5d;cursor: pointer;box-shadow: 1px 1px 2px 1px #000;border-radius: 5px;}
.popup-content-wrapper{margin-top: 25px;}
</style>
public function createfileanddir() {Get content from file and directory
$directoryname = 'directoryname';
$filename = 1;
$directory = APPPATH . 'uploads/cache/'.$directoryname;
if (!file_exists($directory)) {
mkdir($directory, 0777, true);
}
$file = APPPATH . 'uploads/cache/'.$directoryname.'/'.$filename.'.json';
if (file_exists($file)) {
unlink($file);
}
if (!file_exists($file)) {
$settings = [
'settings'=>[],
'socialSettingsArr'=>[],
'pageSettings'=>[],
];
$fh = fopen($file, 'w');
fwrite($fh, json_encode($settings));
fclose($fh);
}
}
public function getfiles() {
$directoryname = 'directoryname';
$directory = 'uploads/cache/'.$directoryname;
$files = array_diff(scandir($directory), array('.', '..'));
if(count($files) > 0){
foreach ($files as $file):
$file = $directory . '/'.$file;
$storedata = file_get_contents($file);
$storedata = json_decode($storedata, true);
echo '<pre>';print_r($storedata);
endforeach;
}
}
Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'inventory_stock_1' doesn't exist, query was:........Solution
1) Open your phpmyadmin
2) Remove your current "inventory_stock_1" if available
3) Run following query on sql
CREATE
SQL SECURITY INVOKER
VIEW `inventory_stock_1`
AS
SELECT
DISTINCT
legacy_stock_status.product_id,
legacy_stock_status.website_id,
legacy_stock_status.stock_id,
legacy_stock_status.qty quantity,
legacy_stock_status.stock_status is_salable,
product.sku
FROM `cataloginventory_stock_status` `legacy_stock_status`
INNER JOIN `catalog_product_entity` product
ON legacy_stock_status.product_id = product.entity_id;
3) Reindex your store data then check your store.
Shopify API version 2019-07 you do indeed need to use cursor-based pagination.
First make a normal API call, include the header response.
Then in the header response API, you will see the "link" parameter with rel next or previous.
Extract the page_info and then make another call with page_info.
The first API call is something like this:
https://.....@abc.myshopify.com/admin/api/2019-10/products.json?limit=2&published_status=published
To get header response from API response :
function getheaderarray($apiresponse){
$data = explode("\n",$apiresponse);
$headers['status'] = $data[0];
array_shift($data);
foreach($data as $part){
$middle = explode(":",$part,2);
if ( !isset($middle[1]) ) { $middle[1] = null; }
$headers[trim($middle[0])] = trim($middle[1]);
}
return $headers;
}
Then the second API call is something like this:
https://.....@abc.myshopify.com/admin/api/2019-10/products.json?limit=2&page_info=abcdsf21asdf3afdfdfd1safd51s3f1x32ref4asdj
When you make the second call, do not add any filers as the filters will be applied from the first call.
FYI: if your testing in a browser due to the way the link is in angle brackets, it will be hidden, so just view source code in your developer environment.