Changeset 1061624
- Timestamp:
- 01/06/2015 08:45:58 PM (11 years ago)
- Location:
- 2kb-amazon-affiliates-store/trunk
- Files:
-
- 12 edited
-
KbAmazonController.php (modified) (1 diff)
-
KbAmazonImporter.php (modified) (2 diffs)
-
lib/KbAmazonItems.php (modified) (1 diff)
-
plugin.php (modified) (2 diffs)
-
query.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
store_functions.php (modified) (1 diff)
-
template/admin/css/default.css (modified) (1 diff)
-
template/admin/importBySearch.phtml (modified) (4 diffs)
-
template/admin/importItemsWithGallery.phtml (modified) (2 diffs)
-
template/admin/layout.phtml (modified) (4 diffs)
-
template/admin/version.phtml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
2kb-amazon-affiliates-store/trunk/KbAmazonController.php
r993771 r1061624 128 128 $data = array(); 129 129 $importer = new KbAmazonImporter; 130 if (isset($_ POST['search']) && (!empty($_POST['category']) || !empty($_POST['categoryName']))) {131 $category = !empty($_ POST['categoryName'])132 ? $_ POST['categoryName']133 : $importer->getAmazonCategory($_ POST['category']);130 if (isset($_GET['search']) && (!empty($_GET['category']) || !empty($_GET['categoryName']))) { 131 $category = !empty($_GET['categoryName']) 132 ? $_GET['categoryName'] 133 : $importer->getAmazonCategory($_GET['category']); 134 134 135 135 $resultSet = $importer->search( 136 $_POST['search'], 137 $category 136 $_GET['search'], 137 $category, 138 null, 139 (isset($_GET['kbpage']) ? $_GET['kbpage'] : null) 138 140 ); 139 141 140 142 if ($resultSet->isValid()) { 143 $data['resultSet'] = $resultSet; 141 144 $data['items'] = $resultSet->getItems(); 142 145 $data['addItemsTemplate'] = $this->getTemplatePath('importItemsWithGallery'); -
2kb-amazon-affiliates-store/trunk/KbAmazonImporter.php
r1007437 r1061624 369 369 * @return \KbAmazonItems 370 370 */ 371 public function search($search, $category, $nodeId = null )371 public function search($search, $category, $nodeId = null, $page = null) 372 372 { 373 373 $result = getKbAmazonApi() 374 374 ->responseGroup('Large') 375 ->optionalParameters(array('MerchantId' => 'All' ))375 ->optionalParameters(array('MerchantId' => 'All', 'ItemPage' => $page)) 376 376 ->category($category) 377 377 ->search($search, $nodeId); 378 378 379 $this->countAmazonRequest(); 379 380 return new KbAmazonItems($result, true); … … 850 851 public function getUrlItems($url) 851 852 { 853 set_time_limit(90); 852 854 $asins = $this->getUrlAsins($url); 853 855 $items = array(); -
2kb-amazon-affiliates-store/trunk/lib/KbAmazonItems.php
r920982 r1061624 35 35 } 36 36 37 public function getTotalResults() 38 { 39 return isset($this->result['Items']['TotalResults']) ? $this->result['Items']['TotalResults'] : 0; 40 } 41 42 public function getTotalPages() 43 { 44 return isset($this->result['Items']['TotalPages']) ? $this->result['Items']['TotalPages'] : 0; 45 } 46 37 47 public function getItems() 38 48 { -
2kb-amazon-affiliates-store/trunk/plugin.php
r1040414 r1061624 4 4 * Plugin URI: http://www.2kblater.com/?p=8318 5 5 * Description: Amazon Affiliate Store Plugin With Cart, Checkout, Custom Themes. Easy to manage and setup. Sell wide range of physical and digital products imported from Amazon Affiliate API using 90 days cookie reference. This plugin is released with GPL2 license. 6 * Version: 1. 0.106 * Version: 1.1.0 7 7 * Author: 2kblater.com 8 8 * Author URI: http://www.2kblater.com … … 16 16 } 17 17 18 define('KbAmazonVersion', '1. 0.10');19 define('KbAmazonVersionNumber', 1 010);18 define('KbAmazonVersion', '1.1.0'); 19 define('KbAmazonVersionNumber', 110); 20 20 define('KbAmazonStoreFolderName', pathinfo(dirname(__FILE__), PATHINFO_FILENAME)); 21 21 define('KbAmazonStorePluginPath', dirname(__FILE__) . '/'); -
2kb-amazon-affiliates-store/trunk/query.php
r920982 r1061624 4 4 && isset($_GET['check']) 5 5 && $_GET['check'] == getKbAmz()->getSecret()) { 6 6 set_time_limit(90); 7 7 require_once KbAmazonStorePluginPath . 'lib/phpQuery-onefile.php'; 8 8 -
2kb-amazon-affiliates-store/trunk/readme.txt
r1040414 r1061624 3 3 Requires at least: 4.0 4 4 Tested up to: 4.0 5 Stable tag: 1. 0.105 Stable tag: 1.1.0 6 6 License: GPLv2 or later 7 7 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 36 36 37 37 == Changelog == 38 = 1.0.10 = 39 isProductAvailable now only checks for new and free products to determine availability 38 = 1.1.0 = 39 Import timeout increased from default 30sec. to 90 sec. 40 Added pagination on the search page. 40 41 = 1.0.9 = 41 42 kb_amz_list_products shortcode accept short code parameters with php code. Ex. [kb_amz_list_products attribute_value="<? date('Y-m-d', time() - 3600); ?>"]. -
2kb-amazon-affiliates-store/trunk/store_functions.php
r1004924 r1061624 371 371 return implode(array_slice($parts, 0, $last_part)); 372 372 } 373 374 function kbAmzBootstrapPagination($count, $perPage) 375 { 376 $query = $_GET; 377 378 $curPage = isset($_GET['kbpage']) ? $_GET['kbpage'] : 1; 379 $data = array(); 380 if($count){ 381 $pages = ceil($count / $perPage); 382 if($pages > 1){ 383 384 $page = $curPage == 1 ? 1 : $curPage - 1; 385 $query['kbpage'] = $page; 386 $data[] = \sprintf( 387 '<li%s><a href="?%s">%s</a></li>' . PHP_EOL, 388 $curPage == 1 ? ' class="disabled"' : '', 389 http_build_query($query), 390 '«' 391 ); 392 $query['kbpage'] = 1; 393 $data[] = \sprintf( 394 '<li%s><a href="?%s">%s</a></li>' . PHP_EOL, 395 $curPage == 1 ? ' class="disabled first"' : ' class="first"', 396 http_build_query($query), 397 __('First') 398 ); 399 400 for($i = 1; $i <= $pages; $i++) { 401 $canAdd = false; 402 if ($i >= $curPage - 5 && $i <= $curPage + 5) { 403 $canAdd = true; 404 } 405 406 if (!$canAdd) { 407 continue; 408 } 409 410 $query['kbpage'] = $i; 411 $data[] = \sprintf( 412 '<li%s><a href="?%s">%s</a></li>' . PHP_EOL, 413 $i == $curPage ? ' class="active"' : '', 414 http_build_query($query), 415 $i 416 ); 417 418 419 } 420 421 $query['kbpage'] = $pages; 422 $data[] = \sprintf( 423 '<li%s><a href="?%s">%s</a></li>' . PHP_EOL, 424 $curPage == $pages ? ' class="disabled last"' : ' class="last"', 425 http_build_query($query), 426 __('Last') 427 ); 428 429 $page = $curPage == $pages ? $pages : $curPage + 1; 430 $query['kbpage'] = $page; 431 $data[] = \sprintf( 432 '<li%s><a href="?%s">%s</a></li>' . PHP_EOL, 433 $curPage == $pages ? ' class="disabled"' : '', 434 http_build_query($query), 435 '»' 436 ); 437 } 438 } 439 440 if (!empty($data)) { 441 return \sprintf( 442 '<ul class="pagination">%s</ul>' . PHP_EOL, 443 join('', $data) 444 ); 445 } 446 } 447 448 function kbAmzHiddenInput() 449 { 450 if (!empty($_GET)) { 451 $data = array(); 452 foreach ($_GET as $name => $val) { 453 $data[] = sprintf( 454 '<input type="hidden" name="%s" value="%s"/>', 455 $name, 456 $val 457 ); 458 } 459 return implode(PHP_EOL, $data); 460 } 461 } -
2kb-amazon-affiliates-store/trunk/template/admin/css/default.css
r1004924 r1061624 27 27 height: 180px; 28 28 overflow: hidden; 29 text-align: center; 29 30 } 30 31 .kb-amz-product-attributes #sortable2 input{ -
2kb-amazon-affiliates-store/trunk/template/admin/importBySearch.phtml
r1007437 r1061624 1 <form role="form" method=" post">1 <form role="form" method="get"> 2 2 <div class="alert alert-success">Use Category from the select or write down your own. <a href="http://docs.aws.amazon.com/AWSECommerceService/latest/DG/BrowseNodeIDs.html" target="_blank">Check this link for amazon categories</a></div> 3 3 <div class="row"> … … 13 13 <div class="form-group"> 14 14 <label for="category" class="control-label"> 15 <?php echo __(' Category'); ?>15 <?php echo __('Select Category'); ?> 16 16 </label> 17 17 <select name="category" class="form-control" value="<?php echo getKbPostVar('category');?>"> … … 23 23 <div class="form-group"> 24 24 <label for="categoryName" class="control-label"> 25 <?php echo __(' Category Name'); ?>25 <?php echo __('Or Write a Category Name'); ?> 26 26 </label> 27 27 <input type="text" name="categoryName" class="form-control" value="<?php echo getKbPostVar('categoryName');?>" /> … … 32 32 <button type="submit" class="btn btn-primary" name="submit" value="load"><?php echo __('Search'); ?></button> 33 33 </div> 34 <?php echo kbAmzHiddenInput(); ?> 34 35 </form> 36 37 <?php 38 if ($this->resultSet) { 39 echo '<div class="form-group">'; 40 echo sprintf( 41 '<span class="label label-default">%s %s %s %s %s</span>', 42 $this->resultSet->getTotalResults(), 43 __('Items'), 44 __('in'), 45 $this->resultSet->getTotalPages(), 46 __('Pages') 47 ); 48 echo sprintf( 49 ' <span class="label label-info">%s</span>', 50 __('Amazon is allowing to browse up to 10 pages of results.') 51 ); 52 echo '</div>'; 53 } 54 ?> 35 55 36 56 <?php -
2kb-amazon-affiliates-store/trunk/template/admin/importItemsWithGallery.phtml
r920982 r1061624 5 5 <div class="row kb-amz-url-upload" id="kb-amz-categories-products"> 6 6 <?php foreach ($this->items as $item): ?> 7 <label class="col-sm- 3col-md-2">7 <label class="col-sm-2 col-md-2"> 8 8 <div class="thumbnail"> 9 9 <div class="import-image"> … … 20 20 <?php endforeach; ?> 21 21 </div> 22 23 <?php 24 if ($this->resultSet && $this->resultSet->getTotalResults() > 10) { 25 $number = $this->resultSet->getTotalResults(); 26 echo kbAmzBootstrapPagination($number, 10); 27 } 28 ?> 22 29 23 30 <div class="row"> -
2kb-amazon-affiliates-store/trunk/template/admin/layout.phtml
r920982 r1061624 8 8 <ul class="nav nav-tabs"> 9 9 <?php 10 $query = array( 11 'page' => $_GET['page'], 12 'kbAction' => $_GET['kbAction'] 13 ); 10 14 $i = 0; 11 15 foreach($this->actions as $action): … … 21 25 '<li class="%s"><a href="?%s">%s</a></li>', 22 26 $subPageAction ? 'active' : '', 23 http_build_query(array_merge($ _GET, array('kbAction' => $page['action']))),27 http_build_query(array_merge($query, array('kbAction' => $page['action']))), 24 28 $page['label'] 25 29 ); … … 43 47 '<li class="%s"><a href="?%s">%s %s</a></li>', 44 48 $isActive ? 'active' : '', 45 http_build_query(array_merge($ _GET, array('kbAction' => $action['action']))),49 http_build_query(array_merge($query, array('kbAction' => $action['action']))), 46 50 (isset($action['icon']) ? '<span class="glyphicon '.$action['icon'].'"></span>' : ''), 47 51 $action['label'] … … 75 79 </div> 76 80 </div> 81 <script> 82 (function ($, params) { 83 $.each(params, function (name, value) { 84 $('[name="'+name+'"]').val(value); 85 }); 86 })(jQuery, <?php echo json_encode($_GET); ?>); 87 </script> -
2kb-amazon-affiliates-store/trunk/template/admin/version.phtml
r1040414 r1061624 1 1 <div class="row" id="kb-amz-version"> 2 2 <div class="col-sm-12"> 3 <h4>1. 0.10</h4>3 <h4>1.1.0</h4> 4 4 <ul style="list-style-type: disc;"> 5 <li>isProductAvailable now only checks for new and free products to determine availability</li> 5 <li>Import timeout increased from default 30sec. to 90 sec.</li> 6 <li>Added pagination on the <a href="?page=kbAmz&kbAction=importBySearch">search page</a>.</li> 6 7 </ul> 7 8 <h4>1.0.9</h4>
Note: See TracChangeset
for help on using the changeset viewer.