Changeset 1128309
- Timestamp:
- 04/05/2015 07:38:28 PM (11 years ago)
- Location:
- 2kb-amazon-affiliates-store/trunk
- Files:
-
- 3 added
- 16 edited
-
KbAmazonController.php (modified) (2 diffs)
-
KbAmazonImporter.php (modified) (8 diffs)
-
KbAmazonStore.php (modified) (1 diff)
-
KbAmzOptions.php (modified) (1 diff)
-
lib/KbAmazonItem.php (modified) (1 diff)
-
lib/kbAmzApi.php (modified) (4 diffs)
-
plugin.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
store_functions.php (modified) (1 diff)
-
store_init.php (modified) (4 diffs)
-
store_shortcodes.php (modified) (2 diffs)
-
template/admin/css/default.css (modified) (4 diffs)
-
template/admin/index.phtml (modified) (5 diffs)
-
template/admin/kbAmzNetworkGetProductsToSync.phtml (added)
-
template/admin/layout.phtml (modified) (3 diffs)
-
template/admin/network.phtml (added)
-
template/admin/productsShortCodes.phtml (modified) (2 diffs)
-
template/admin/shortCodeProduct.phtml (added)
-
template/default/css/style.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
2kb-amazon-affiliates-store/trunk/KbAmazonController.php
r1122895 r1128309 30 30 add_action('wp_ajax_kbAmzLoadItemPreview', array($this, 'kbAmzLoadItemPreviewAction')); 31 31 add_action('wp_ajax_kbAmzImportItem', array($this, 'kbAmzImportItemAjaxAction')); 32 add_action('wp_ajax_kbAmzNetworkMembers', array($this, 'networkMembersAction')); 33 add_action('wp_ajax_kbAmzNetworkGetProductsToSync', array($this, 'kbAmzNetworkGetProductsToSyncAction')); 34 add_action('wp_ajax_kbAmzNetworkImportProduct', array($this, 'kbAmzNetworkImportProductAction')); 35 36 32 37 } 33 38 … … 601 606 return $view; 602 607 } 608 609 public function kbAmzNetworkImportProductAction() 610 { 611 $response = array(); 612 try { 613 $imported = []; 614 foreach ($_POST['items'] as $itemData) { 615 $item = unserialize(base64_decode($itemData['item'])); 616 $importer = new KbAmazonImporter; 617 $importer->updateProductPrice($item); 618 $imported[] = array( 619 'asin' => $itemData['asin'] 620 ); 621 } 622 623 $response['items'] = $imported; 624 $response['success'] = true; 625 } catch (Exception $e) { 626 $response['success'] = false; 627 $response['error'] = $e->getMessage(); 628 getKbAmz()->addException('Newtwork Product Fetch', $e->getMessage()); 629 630 } 631 echo json_encode($response); 632 die; 633 } 634 635 636 public function kbAmzNetworkGetProductsToSyncAction() 637 { 638 $asins = getKbAmz()->getProductsAsinsToUpdate(50); 639 $products = array(); 640 foreach ($asins as $asin) { 641 $products[$asin] = getKbAmz()->getProductByAsin($asin); 642 } 643 $sizes = get_intermediate_image_sizes(); 644 $size = 'thumbnail'; 645 if (in_array('small', $sizes)) { 646 $size = 'small'; 647 } else if (in_array('medium', $sizes)) { 648 $size = 'medium'; 649 } 650 651 $view = new KbView(array()); 652 $view->setTemplate($this->getTemplatePath('kbAmzNetworkGetProductsToSync')); 653 $view->products = $products; 654 $view->size = $size; 655 echo $view; 656 die; 657 } 658 659 public function networkMembersAction() 660 { 661 662 $api = new KbAmzApi(getKbAmz()->getStoreId()); 663 $result = $api->getNetworkListHtml(); 664 if ($result->error) { 665 $data = array(); 666 $data['page'] = 'kbAmz'; 667 $data['kbAction'] = 'network'; 668 echo '<div role="alert" class="alert alert-danger">Unable to connect to the service server. <a href="?'. http_build_query($data).'">Please reload the page</a>.</div>'; 669 } else { 670 echo $result->content; 671 } 672 die; 673 } 674 675 public function networkAction() 676 { 677 $data = array(); 678 $user = wp_get_current_user(); 679 $data['user'] = wp_get_current_user(); 680 $data['siteOwnerName'] = $user->data->display_name; 681 if (isset($user->data->first_name) 682 && !empty($user->data->first_name) 683 && isset($user->data->last_name) 684 && !empty($user->data->last_name)) { 685 $data['siteOwnerName'] = sprintf( 686 '%s %s', 687 $user->data->first_name, 688 $user->data->last_name 689 ); 690 } 691 692 $data['siteOwnerEmail'] = $user->data->user_email; 693 $data['siteName'] = get_bloginfo('name'); 694 $data['siteUrl'] = get_bloginfo('url'); 695 $data['siteInfo'] = get_bloginfo('description'); 696 697 if (isset($_POST['submit'])) { 698 699 $data = 700 array( 701 'siteOwnerName' => empty($_POST['siteOwnerName']) ? $data['siteOwnerName'] : $_POST['siteOwnerName'], 702 'siteOwnerEmail' => empty($_POST['siteOwnerEmail']) ? $data['siteOwnerEmail'] : $_POST['siteOwnerEmail'], 703 'siteName' => empty($_POST['siteName']) ? $data['siteName'] : $_POST['siteName'], 704 'siteUrl' => empty($_POST['siteUrl']) ? $data['siteUrl'] : $_POST['siteUrl'], 705 'siteInfo' => substr(empty($_POST['siteInfo']) ? $data['siteInfo'] : $_POST['siteInfo'], 0, 250), 706 'siteActive' => $_POST['submit'] == 'join', 707 'siteHealth' => getKbAmzStoreHealth() 708 ); 709 710 getKbAmz()->setOption('siteNetwork', $data); 711 712 $api = new KbAmzApi(getKbAmz()->getStoreId()); 713 $result = $api->setUser($data); 714 715 if (isset($result->error) && $result->error) { 716 $this->messages[] = array('Unable to join the 2kb Amazon Network at this time. Error: ' .$result->error, 'alert-warning'); 717 } else { 718 if ($_POST['submit'] == 'join') { 719 $this->messages[] = array('You successfully <b>joined</b> 2kb Amazon Network', 'alert-success'); 720 } else { 721 $this->messages[] = array('You successfully <b>left</b> 2kb Amazon Network', 'alert-danger'); 722 } 723 } 724 } else { 725 $siteNetwork = getKbAmz()->getOption('siteNetwork'); 726 if (!empty($siteNetwork)) { 727 $data = $siteNetwork; 728 } 729 } 730 731 732 $data['canLeave'] = isset($data['siteActive']) && $data['siteActive']; 733 734 $view = new KbView($data); 735 return $view; 736 } 737 738 public function shortCodeProductAction($atts) 739 { 740 $post = null; 741 if ($atts['asin']) { 742 $post = getKbAmz()->getProductByAsin($atts['asin']); 743 if (!$post) { 744 $_POST['asin'] = $atts['asin']; 745 $this->importByAsinAction(); 746 } 747 $post = getKbAmz()->getProductByAsin($atts['asin']); 748 } else { 749 $post = get_post($atts['postId']); 750 } 751 752 if (!$post) { 753 throw new Exception('Invalid product, check postId or asin'); 754 } 755 $atts['post'] = $post; 756 $atts['meta'] = getKbAmz()->getProductMeta($post->ID); 757 $view = new KbView($atts); 758 $view->setTemplate($this->getTemplatePath('shortCodeProduct')); 759 return $view; 760 } 603 761 604 762 protected function getActions() { -
2kb-amazon-affiliates-store/trunk/KbAmazonImporter.php
r1122895 r1128309 390 390 } 391 391 392 /** 392 public function getResponseGroup() 393 { 394 return 395 array( 396 'Large', 397 'Offers', 398 'OfferFull', 399 'OfferSummary', 400 'OfferListings', 401 'PromotionSummary', 402 'Variations', 403 'VariationImages', 404 'VariationSummary', 405 'VariationMatrix', 406 'VariationOffers', 407 'ItemAttributes', 408 'Accessories', 409 'EditorialReview', 410 'SalesRank', 411 'BrowseNodes', 412 'Images', 413 'Similarities', 414 'Reviews', 415 'SearchInside', 416 'PromotionalTag', 417 'AlternateVersions', 418 'Collections', 419 'ShippingCharges', 420 //'RelatedItems', 421 // No access 422 //'ShippingOptions', 423 ); 424 } 425 426 /** 393 427 * 394 428 * @param str $asin … … 398 432 { 399 433 if (!$responseGroup) { 400 $responseGroup = array( 401 'Large', 402 'Offers', 403 'OfferFull', 404 'OfferSummary', 405 'OfferListings', 406 'PromotionSummary', 407 'Variations', 408 'VariationImages', 409 'VariationSummary', 410 'VariationMatrix', 411 'VariationOffers', 412 'ItemAttributes', 413 'Accessories', 414 'EditorialReview', 415 'SalesRank', 416 'BrowseNodes', 417 'Images', 418 'Similarities', 419 'Reviews', 420 'SearchInside', 421 'PromotionalTag', 422 'AlternateVersions', 423 'Collections', 424 'ShippingCharges', 425 //'RelatedItems', 426 // No access 427 //'ShippingOptions', 428 ); 434 $responseGroup = $this->getResponseGroup(); 429 435 } else { 430 436 $responseGroup = is_array($responseGroup) ? $responseGroup : array($responseGroup); … … 449 455 $result = getKbAmazonApi() 450 456 ->responseGroup(implode(',', $responseGroup)) 451 ->optionalParameters(array('MerchantId' => 'All'))452 457 ->lookup($asin); 453 454 458 } catch (Exception $e) { 455 459 if ($sleep) { … … 585 589 $meta['PriceAmountFormatted'] = 0; 586 590 587 // if (isset($meta['Offers.Offer.OfferListing.Price.FormattedPrice'])) { 588 // $meta['PriceAmount'] = $meta['Offers.Offer.OfferListing.Price.Amount']; 589 // $meta['PriceAmountFormatted'] = $meta['Offers.Offer.OfferListing.Price.FormattedPrice']; 590 // } else { 591 // $sort = array(); 592 // foreach ($this->pricePairs as $pair) { 593 // if (isset($meta[$pair[0]]) 594 // && isset($meta[$pair[1]])) { 595 // $sort[] = array( 596 // 'PriceAmountFormatted' => $meta[$pair[0]], 597 // 'PriceAmount' => $meta[$pair[1]], 598 // 'order' => $meta[$pair[1]], 599 // ); 600 // } 601 // } 602 // if (!empty($sort)) { 603 // usort($sort, 'kbAmzSortOrder'); 604 // $pair = $sort[key($sort)]; 605 // $meta['PriceAmount'] = $pair['PriceAmount']; 606 // $meta['PriceAmountFormatted'] = $pair['PriceAmountFormatted']; 607 // } 608 // } 609 /** 610 * Old version 611 */ 612 if (isset($meta['Offers.Offer.OfferListing.Price.FormattedPrice'])) { 591 //1. OfferSummary.LowestNewPrice.FormattedPrice 592 //2. Offers.Offer.OfferListing.SalePrice.FormattedPrice 593 //3. Offers.Offer.OfferListing.Price.FormattedPrice 594 //4. ItemAttributes.ListPrice.FormattedPrice 595 596 if (isset($meta['Offers.Offer.OfferListing.SalePrice.FormattedPrice'])) { 597 $meta['PriceAmountFormatted'] = $meta['Offers.Offer.OfferListing.SalePrice.FormattedPrice']; 598 $meta['PriceAmount'] = $meta['Offers.Offer.OfferListing.SalePrice.Amount']; 599 } else if (isset($meta['OfferSummary.LowestNewPrice'])) { 600 $meta['PriceAmountFormatted'] = $meta['OfferSummary.LowestNewPrice.FormattedPrice']; 601 $meta['PriceAmount'] = $meta['OfferSummary.LowestNewPrice.Amount']; 602 } else if (isset($meta['Offers.Offer.OfferListing.Price'])) { 603 $meta['PriceAmountFormatted'] = $meta['Offers.Offer.OfferListing.Price.FormattedPrice']; 604 $meta['PriceAmount'] = $meta['Offers.Offer.OfferListing.Price.Amount']; 605 } else if (isset($meta['ItemAttributes.ListPrice.FormattedPrice'])) { 606 $meta['PriceAmountFormatted'] = $meta['ItemAttributes.ListPrice.FormattedPrice']; 607 $meta['PriceAmount'] = $meta['ItemAttributes.ListPrice.Amount']; 608 } else if (isset($meta['Offers.Offer.OfferListing.Price.FormattedPrice'])) { 609 /** 610 * @TODO CHECK BELOW! 611 */ 613 612 $meta['PriceAmount'] = $meta['Offers.Offer.OfferListing.Price.Amount']; 614 613 $meta['PriceAmountFormatted'] = $meta['Offers.Offer.OfferListing.Price.FormattedPrice']; … … 629 628 $meta['PriceAmount'] = $meta['OfferSummary.LowestCollectiblePrice.Amount']; 630 629 } 631 630 632 631 $meta['PriceAmount'] = self::paddedNumberToDecial($meta['PriceAmount']); 633 632 } … … 651 650 652 651 653 public function saveProduct(KbAmazonItem $item, $isSimilar = false )652 public function saveProduct(KbAmazonItem $item, $isSimilar = false, $disableEvents = false) 654 653 { 655 654 $postExists = $this->itemExists($item); … … 660 659 $std->item = $item; 661 660 662 do_action('KbAmazonImporter::preSaveProduct', $std); 661 if (!$disableEvents) { 662 do_action('KbAmazonImporter::preSaveProduct', $std); 663 } 663 664 664 665 $postExists = $std->postId; … … 807 808 $std->importer = $this; 808 809 $std->postExists = $postExists; 809 810 do_action('KbAmazonImporter::saveProduct', $std); 810 if (!$disableEvents) { 811 do_action('KbAmazonImporter::saveProduct', $std); 812 } 811 813 812 814 return array( -
2kb-amazon-affiliates-store/trunk/KbAmazonStore.php
r1122895 r1128309 108 108 ), 109 109 'active' => false, 110 ) 110 ), 111 'product' => array( 112 'code' => 'kb_amz_product', 113 'params' => array( 114 '' => '<span class="label label-success">NEW</span>', 115 'asin' => 'Use asin or post id', 116 'ID' => 'Use post id or asin' 117 ), 118 'active' => null, 119 ), 111 120 ); 112 121 -
2kb-amazon-affiliates-store/trunk/KbAmzOptions.php
r1122895 r1128309 37 37 */ 38 38 'KbAmzV2VariantsMessageSeen' => false, 39 'AttributesCountMessageSeen' => false, 39 40 ); 40 41 -
2kb-amazon-affiliates-store/trunk/lib/KbAmazonItem.php
r1122895 r1128309 55 55 56 56 $isValid = false; 57 if (!isset($this->item['ItemAttributes']['Title']) 58 || !isset($this->item['ASIN'])) { 57 if (!isset($this->item['ASIN'])) { 59 58 $isValid = false; 60 59 } else { -
2kb-amazon-affiliates-store/trunk/lib/kbAmzApi.php
r1118181 r1128309 6 6 const PRODUCTS_CATEGORY = 86; 7 7 8 protected $apiKey = null; 8 protected $apiKey = null; 9 protected $apiKey2 = null; 10 11 12 public function __construct() 13 { 14 $this->apiKey = getKbAmz()->getStoreId(); 15 16 } 9 17 10 public function __construct($apiKey)18 public function setUser($data) 11 19 { 12 $this->apiKey = $apiKey;20 return $this->getRequest('setUser', $data); 13 21 } 14 22 … … 22 30 { 23 31 return $this->getRequest('getProductsListHtml'); 32 } 33 34 public function getNetworkListHtml() 35 { 36 return $this->getRequest('getNetworkListHtml'); 24 37 } 25 38 … … 37 50 { 38 51 $params['2kbProductsApiAction'] = $action; 39 $params['cat'] = self::PRODUCTS_CATEGORY; 40 $params['type'] = 'json'; 41 $params['apiType'] = 'kbAmz'; 42 $params['apiKey'] = $this->apiKey; 52 $params['cat'] = self::PRODUCTS_CATEGORY; 53 $params['type'] = 'json'; 54 $params['apiType'] = 'kbAmz'; 55 $params['apiKey'] = $this->apiKey; 56 $params['requestTime'] = date('Y-m-d H:i:s'); 43 57 44 58 $requestUrl = sprintf( … … 46 60 http_build_query($params) 47 61 ); 48 //echo $requestUrl;die; 49 $content = file_get_contents($requestUrl); 62 63 $response = wp_remote_get($requestUrl); 64 $content = ''; 65 if (isset($response['body'])) { 66 $content = $response['body']; 67 } 50 68 $data = array(); 51 69 if (!empty($content)) { -
2kb-amazon-affiliates-store/trunk/plugin.php
r1122895 r1128309 4 4 * Plugin URI: http://www.2kblater.com/?p=8318 5 5 * Description: Amazon Affiliate Store Plugin With Variants, Cart, Checkout, Custom Themes, Variants and Versions. 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: 2.0.0 BETA 26 * Version: 2.0.0 BETA 3 7 7 * Author: 2kblater.com 8 8 * Author URI: http://www.2kblater.com … … 16 16 } 17 17 18 define('KbAmazonVersion', '2.0.0 BETA 2');18 define('KbAmazonVersion', '2.0.0 BETA 3'); 19 19 define('KbAmazonVersionNumber', 200); 20 20 define('KbAmazonStoreFolderName', pathinfo(dirname(__FILE__), PATHINFO_FILENAME)); -
2kb-amazon-affiliates-store/trunk/readme.txt
r1122895 r1128309 37 37 38 38 == Changelog == 39 = 2.0.0 BETA 3= 40 Product Short Code added 41 Prices Fixed 42 Store Sync Health added 43 Layout Update 39 44 = 2.0.0 BETA 2= 40 45 New Import loaded, custom categories are now working. -
2kb-amazon-affiliates-store/trunk/store_functions.php
r1119725 r1128309 484 484 return $output; 485 485 } 486 487 function getKbAmzStoreHealth() 488 { 489 $hours = 0; 490 $count = getKbAmz()->getProductsToUpdateCount(); 491 if ($count > 0) { 492 $per = getKbAmz()->getOption('updateProductsPriceCronNumberToProcess'); 493 $interval = getKbAmz()->getOption('updateProductsPriceCronInterval'); 494 $intervals = $count / $per; 495 $intervalHours = 1; 496 if ($interval == 'twicedaily') { 497 $intervalHours = 12; 498 } else if ($interval == 'daily') { 499 $intervalHours = 24; 500 } 501 $hours = ceil($intervals . $intervalHours); 502 } 503 504 $h = round(($hours / 24) * 100); 505 return $h; 506 } 507 508 function getKbAmzStoreHealthHtml() 509 { 510 $health = getKbAmzStoreHealth(); 511 $class = 'danger'; 512 if ($health > 80 && $health <= 100) { 513 $class = 'success'; 514 } else if ($health > 50 && $health <= 100) { 515 $class = 'warning'; 516 } 517 $percent = $health > 100 ? 100 : $health; 518 ob_start(); 519 ?> 520 <div class="progress"> 521 <div class="progress-bar progress-bar-<?php echo $class;?>" style="width: <?php echo $percent; ?>%;"> 522 <?php echo $health; ?>% 523 </div> 524 </div> 525 <?php 526 return ob_get_clean(); 527 } -
2kb-amazon-affiliates-store/trunk/store_init.php
r1122895 r1128309 23 23 * CRONS 24 24 */ 25 if (!wp_next_scheduled('kbAmzSyncNetwork') ) { 26 wp_schedule_event( 27 time(), 28 86400, 29 'kbAmzSyncNetwork' 30 ); 31 } 32 add_action('kbAmzSyncNetwork', 'kbAmzSyncNetworkFunction'); 33 34 function kbAmzSyncNetworkFunction() 35 { 36 $data = getKbAmz()->getOption('siteNetwork'); 37 if (!empty($data) && $data['siteActive']) { 38 $api = new KbAmzApi(getKbAmz()->getStoreId()); 39 $data['siteHealth'] = getKbAmzStoreHealth(); 40 $api->setUser($data); 41 } 42 } 43 25 44 if (!wp_next_scheduled('kbAmzDownloadProductsCron') ) { 26 45 wp_schedule_event( … … 30 49 ); 31 50 } 32 33 51 add_action('kbAmzDownloadProductsCron', 'kbAmzDownloadProductsCronFunction'); 34 52 … … 151 169 } 152 170 } 153 154 155 171 156 172 … … 311 327 return $query; 312 328 } 329 330 331 if (isset($_GET['kbAction']) 332 && $_GET['kbAction'] == 'KbAmzNetworkGetProduct' 333 && isset($_GET['asin'])) { 334 335 add_action('init', 'kbAmzTriggerManualUpdateCronJobs'); 336 function kbAmzTriggerManualUpdateCronJobs() 337 { 338 $response = array(); 339 $asin = $_GET['asin']; 340 $responseGroup = array( 341 'Offers', 342 'OfferFull', 343 'OfferSummary', 344 'OfferListings', 345 ); 346 try { 347 $importer = new KbAmazonImporter; 348 $result = getKbAmazonApi() 349 ->responseGroup(implode(',', $responseGroup)) 350 ->lookup($asin); 351 $item = new KbAmazonItem($result); 352 $response['item'] = $item->isValid() ? base64_encode(serialize($item)) : null; 353 $response['success'] = $item->isValid(); 354 } catch (Exception $e) { 355 $response['success'] = false; 356 $response['error'] = $e->getMessage(); 357 getKbAmz()->addException('Newtwork Product Fetch', $e->getMessage()); 358 } 359 echo sprintf( 360 ';%s%s(%s);', 361 PHP_EOL, 362 $_GET['callback'], 363 json_encode($response) 364 ); 365 http_response_code(200); 366 die; 367 } 368 } -
2kb-amazon-affiliates-store/trunk/store_shortcodes.php
r1119725 r1128309 1 1 <?php 2 2 !defined('ABSPATH') and exit; 3 4 // [kb_amz_product] 5 function kb_amz_product_func($atts) 6 { 7 $atts = shortcode_atts( array( 8 'ID' => null, 9 'asin' => null, 10 ), $atts); 11 $atts['postId'] = $atts['ID']; 12 13 if (!$atts['postId'] && !$atts['asin']) { 14 return new KbAmzErrorString('[kb_amz_product] - ID or asin parameter is required.'); 15 } 16 17 return getKbAmzAdminController()->shortCodeProductAction($atts); 18 } 19 20 add_shortcode('kb_amz_product', 'kb_amz_product_func'); 3 21 4 22 // [kb_amz_product_attributes] 5 23 function kb_amz_product_attributes_func($atts) { 6 24 $atts = shortcode_atts( array( 7 'post_id' => get_the_ID()25 'postId' => get_the_ID() 8 26 ), $atts); 9 27 … … 27 45 28 46 29 $meta = getKbAmz()->getProductMeta($atts['post _id']);47 $meta = getKbAmz()->getProductMeta($atts['postId']); 30 48 $attributes = getKbAmz()->getShortCodeAttributes(); 31 49 $markup = ''; 32 50 foreach ($attributes as $attr => $label) { 33 51 if (isset($meta[$attr]) && !empty($meta[$attr])) { 34 35 36 // kb-amz-item-price37 38 52 $markup .= sprintf( 39 53 $htmlList, -
2kb-amazon-affiliates-store/trunk/template/admin/css/default.css
r1122895 r1128309 9 9 #kb-amz-admin{ 10 10 padding: 0 20px; 11 padding-left: 0; 11 12 padding-bottom: 20px; 12 13 min-height: 300px; … … 124 125 .icons-actions a 125 126 { 127 position: relative; 126 128 display: inline-block; 127 129 padding: 20px; … … 141 143 #kb-amz-admin label{ 142 144 max-width: 100%; 143 min-width: 300px; 144 } 145 146 .bs-callout { 145 width: 300px; 146 } 147 148 .bs-callout 149 { 147 150 border-color: #eee; 148 151 border-image: none; … … 153 156 padding: 5px 10px; 154 157 } 155 .bs-callout-info { 158 .bs-callout-info 159 { 156 160 border-left-color: #1b809e; 157 161 } 158 .bs-callout-info h4 { 162 .bs-callout-info h4 163 { 159 164 color: #1b809e; 160 165 } 166 167 .kb-amz-icon-action-dot 168 { 169 position: absolute; 170 top: 5px; 171 right: 5px; 172 background: #3c763d; 173 padding: 10px; 174 line-height: 0; 175 font-size: 0; 176 -webkit-border-radius: 10px; 177 -moz-border-radius: 10px; 178 border-radius: 10px; 179 -webkit-box-shadow: 0px 0px 3px 0px rgba(60,118,61,1); 180 -moz-box-shadow: 0px 0px 3px 0px rgba(60,118,61,1); 181 box-shadow: 0px 0px 3px 0px rgba(60,118,61,1); 182 } 183 .kb-amz-icon-action-dot.not-active 184 { 185 background: #a94442; 186 -webkit-box-shadow: 0px 0px 3px 0px rgba(169,68,66,1); 187 -moz-box-shadow: 0px 0px 3px 0px rgba(169,68,66,1); 188 box-shadow: 0px 0px 3px 0px rgba(169,68,66,1); 189 } 190 #sync-container 191 { 192 margin-left: -5px; 193 } 194 .kb-amz-product-sync 195 { 196 width: 120px; 197 margin-left: 10px; 198 margin-bottom: 10px; 199 text-align: center; 200 display: inline-block; 201 vertical-align: top; 202 } 203 .kb-amz-product-sync img 204 { 205 max-width: 100%; 206 } -
2kb-amazon-affiliates-store/trunk/template/admin/index.phtml
r1122895 r1128309 7 7 </div> 8 8 <?php endif; ?> 9 10 <?php if (!getKbAmz()->getOption('AttributesCountMessageSeen') && count(getKbAmz()->getOption('productAttributes')) < 5) : ?> 11 <div class="alert alert-warning" role="alert"> 12 <button aria-label="Close" data-dismiss="alert" class="close" type="button" data-option="AttributesCountMessageSeen" data-option-value="1"><span aria-hidden="true">×</span></button> 13 Your products show only 14 <?php 15 $count = count(getKbAmz()->getOption('productAttributes')); 16 echo sprintf( 17 '%s %s.', 18 $count, 19 $count == 1 ? 'Attribute' : 'Attributes' 20 ); 21 ?> 22 Consider adding more attributes for better selling performance. 23 <b><a href="?<?php echo http_build_query(array_merge($_GET, array('kbAction' => 'productsAttributes')))?>">Add more attributes</a></b> 24 </div> 25 <?php endif; ?> 26 27 28 9 29 <div class="row homepage"> 10 30 <div class="col-sm-3"> … … 15 35 <div class="col-sm-12" style="font-size: 16px;"> 16 36 <div> 17 <span class="label label- info">18 <span class="glyphicon glyphicon-usd"></span> Products:37 <span class="label label-primary" title="Products" data-toggle="tooltip" data-placement="top"> 38 <span class="glyphicon glyphicon-usd"></span> 19 39 <?php echo getKbAmz()->getProductsCount(); ?> 20 40 </span> 21 22 <span class="label label- info">23 <span class="glyphicon glyphicon-download-alt"></span> To Download:41 42 <span class="label label-primary" title="Products to download" data-toggle="tooltip" data-placement="top"> 43 <span class="glyphicon glyphicon-download-alt"></span> 24 44 <?php echo getKbAmz()->getProductsToDownloadCount(); ?> 25 45 </span> 26 27 <span class="label label- info">28 <span class="glyphicon glyphicon-refresh"></span> To Update:46 47 <span class="label label-primary" title="Products to update" data-toggle="tooltip" data-placement="top"> 48 <span class="glyphicon glyphicon-refresh"></span> 29 49 <?php echo getKbAmz()->getProductsToUpdateCount(); ?> 30 50 </span> 31 32 <span class="label label- info">51 52 <span class="label label-primary" title="Time to update" data-toggle="tooltip" data-placement="top"> 33 53 <?php 34 54 $hours = 0; … … 48 68 49 69 ?> 50 <span class="glyphicon glyphicon-time"></span> Time To Update:70 <span class="glyphicon glyphicon-time"></span> 51 71 <?php echo $hours; ?>h 52 72 </span> 53 54 <span class="label label- info">55 <span class="glyphicon glyphicon- repeat"></span> Requests/Avg. Time:73 74 <span class="label label-primary" title="Requests/Avg. Time" data-toggle="tooltip" data-placement="top"> 75 <span class="glyphicon glyphicon-signal"></span> 56 76 <?php echo getKbAmz()->getOption('AmazonRequests', 1); ?> 57 77 / 58 78 <?php echo getKbAmz()->getOption('averageTimeToFetch', 1) * 1000; ?>ms 59 79 </span> 60 </div> 61 <div> 62 <span class="label label-info"> 63 <span class="glyphicon glyphicon-time"></span> Cron Last Run: 80 81 <span class="label label-primary" title="Cron last run" data-toggle="tooltip" data-placement="top"> 82 <span class="glyphicon glyphicon-time"></span> 64 83 <?php echo getKbAmz()->getOption('LastCronRun', '-'); ?> 65 84 </span> 85 86 <div title="Amazon Sync Health" data-toggle="tooltip" data-placement="top" style="width: 100px;display: inline-block;margin-bottom: 0px;vertical-align: middle;"> 87 <?php echo getKbAmzStoreHealthHtml();?> 88 </div> 66 89 </div> 67 90 <br/> … … 222 245 $tips[] = 'Every variant is inserted as new post (the same as none variable products). Product with 3 Sizes and 8 Colors will result in inserting 25 posts.(1st the main product and 3x8 Variants)'; 223 246 $tips[] = 'From where to get ASIN. <a href="?'.http_build_query(array_merge($_GET, array('kbAction' => 'info'))).'#get-asin">Click here to find</a>.'; 247 ?> 224 248 249 <?php if (count(getKbAmz()->getOption('productAttributes')) < 5) : ?> 250 <?php ob_start();?> 251 Your products show only 252 <?php 253 $count = count(getKbAmz()->getOption('productAttributes')); 254 echo sprintf( 255 '%s %s.', 256 $count, 257 $count == 1 ? 'Attribute' : 'Attributes' 258 ); 259 ?> 260 Consider adding more attributes for better selling performance. 261 <b><a href="?<?php echo http_build_query(array_merge($_GET, array('kbAction' => 'productsAttributes')))?>">Add more attributes</a></b> 262 <?php 263 $tips[] = ob_get_clean(); 264 ?> 265 <?php endif; ?> 266 267 268 <?php 225 269 if (!empty($tips)) { 226 270 $tip = $tips[rand(0, count($tips) - 1)]; … … 228 272 } 229 273 ?> 230 <!-- <div class="row icons-actions"> 231 <div class="col-md-3"> 232 <a href="?<?php echo http_build_query(array_merge($_GET, array('kbAction' => 'createStorePage')));?>" class="btn btn-default"> 233 <span aria-hidden="true" class="glyphicon glyphicon-home" style="font-size: 50px;display: block;"></span> 234 Create Store Page 235 </a> 236 </div> 237 </div>--> 274 <div class="icons-actions"> 275 <!-- <a href="?<?php echo http_build_query(array_merge($_GET, array('kbAction' => 'createStorePage')));?>" class="btn btn-default"> 276 <span aria-hidden="true" class="glyphicon glyphicon-home" style="font-size: 50px;display: block;"></span> 277 Create Store Page 278 </a> 279 --> 280 <?php 281 $siteNetwork = getKbAmz()->getOption('siteNetwork'); 282 $joined = isset($siteNetwork['siteActive']) && $siteNetwork['siteActive']; 283 ?> 284 <a href="?<?php echo http_build_query(array_merge($_GET, array('kbAction' => 'network')));?>" class="btn btn-default" title="<?php echo !$joined ? 'Join to 2kb Amazon Network' : 'Joined to 2kb Amazon Network';?>" data-toggle="tooltip" data-placement="bottom"> 285 <span aria-hidden="true" class="glyphicon glyphicon-globe" style="font-size: 50px;display: block;"></span> 286 2kb Amazon Network<br/>(beta, tests only) 287 <?php 288 echo sprintf( 289 '<span class="kb-amz-icon-action-dot %s"> </span>', 290 $joined ? 'active' : 'not-active' 291 ); 292 ?> 293 </a> 294 </div> 238 295 </div> 239 296 </div> -
2kb-amazon-affiliates-store/trunk/template/admin/layout.phtml
r1122895 r1128309 1 1 <div id="kb-amz-admin" class="<?php echo $this->bodyClass; ?>"> 2 <br/>3 2 <?php 4 3 $params = array(); … … 6 5 ?> 7 6 <div id="kb-amz-header"> 8 <ul class="nav nav-tabs"> 9 <?php 10 $query = array( 11 'page' => $_GET['page'], 12 'kbAction' => $_GET['kbAction'] 13 ); 14 $i = 0; 15 foreach($this->actions as $action): 16 if (isset($action['pages'])) { 17 $isActive = false; 18 $subMenuStr = ''; 19 foreach ($action['pages'] as $page) { 20 $subPageAction = false; 21 if (isset($_GET['kbAction']) && $_GET['kbAction'] == $page['action']) { 22 $isActive = $subPageAction = true; 23 } 24 $subMenuStr .= sprintf( 25 '<li class="%s"><a href="?%s">%s</a></li>', 26 $subPageAction ? 'active' : '', 27 http_build_query(array_merge($query, array('kbAction' => $page['action']))), 28 $page['label'] 7 <nav class="navbar navbar-default"> 8 <ul class="nav navbar-nav"> 9 <?php 10 $query = array( 11 'page' => $_GET['page'], 12 'kbAction' => $_GET['kbAction'] 13 ); 14 $i = 0; 15 foreach($this->actions as $action): 16 if (isset($action['pages'])) { 17 $isActive = false; 18 $subMenuStr = ''; 19 foreach ($action['pages'] as $page) { 20 $subPageAction = false; 21 if (isset($_GET['kbAction']) && $_GET['kbAction'] == $page['action']) { 22 $isActive = $subPageAction = true; 23 } 24 $subMenuStr .= sprintf( 25 '<li class="%s"><a href="?%s">%s</a></li>', 26 $subPageAction ? 'active' : '', 27 http_build_query(array_merge($query, array('kbAction' => $page['action']))), 28 $page['label'] 29 ); 30 } 31 32 echo sprintf( 33 '<li class="dropdown %s"><a class="dropdown-toggle" data-toggle="dropdown" href="#">%s %s</a><ul class="dropdown-menu">%s</ul></li>', 34 $isActive ? 'active' : '', 35 (isset($action['icon']) ? '<span class="glyphicon '.$action['icon'].'"></span>' : ''), 36 $action['label'], 37 $subMenuStr 38 ); 39 } else { 40 $isActive = false; 41 if (isset($_GET['kbAction']) && $_GET['kbAction'] == $action['action']) { 42 $isActive= true; 43 } else if (!isset($_GET['kbAction']) && ++$i == 1) { 44 $isActive= true; 45 } 46 echo sprintf( 47 '<li class="%s"><a href="?%s">%s %s</a></li>', 48 $isActive ? 'active' : '', 49 http_build_query(array_merge($query, array('kbAction' => $action['action']))), 50 (isset($action['icon']) ? '<span class="glyphicon '.$action['icon'].'"></span>' : ''), 51 $action['label'] 29 52 ); 30 53 } 31 32 echo sprintf( 33 '<li class="dropdown %s"><a class="dropdown-toggle" data-toggle="dropdown" href="#">%s %s</a><ul class="dropdown-menu">%s</ul></li>', 34 $isActive ? 'active' : '', 35 (isset($action['icon']) ? '<span class="glyphicon '.$action['icon'].'"></span>' : ''), 36 $action['label'], 37 $subMenuStr 38 ); 39 } else { 40 $isActive = false; 41 if (isset($_GET['kbAction']) && $_GET['kbAction'] == $action['action']) { 42 $isActive= true; 43 } else if (!isset($_GET['kbAction']) && ++$i == 1) { 44 $isActive= true; 45 } 46 echo sprintf( 47 '<li class="%s"><a href="?%s">%s %s</a></li>', 48 $isActive ? 'active' : '', 49 http_build_query(array_merge($query, array('kbAction' => $action['action']))), 50 (isset($action['icon']) ? '<span class="glyphicon '.$action['icon'].'"></span>' : ''), 51 $action['label'] 52 ); 53 } 54 endforeach; 55 ?> 56 </ul> 57 54 endforeach; 55 ?> 56 </ul> 57 </nav> 58 58 </div> 59 59 60 60 <div id="kb-amz-content"> 61 <br/>62 61 <?php 63 62 if (!empty($this->messages)) { … … 115 114 }); 116 115 }); 116 $('[data-toggle="tooltip"]').tooltip() 117 117 }); 118 118 })(jQuery, '<?php echo getKbAmzAjaxUrl(); ?>'); -
2kb-amazon-affiliates-store/trunk/template/admin/productsShortCodes.phtml
r1004924 r1128309 19 19 $params = array(); 20 20 foreach ($code['params'] as $nameParamName => $avaialbe) { 21 $params[] = $nameParamName . '="'.$avaialbe.'"'; 21 if ($nameParamName) { 22 $params[] = $nameParamName . '="'.$avaialbe.'"'; 23 } else { 24 $params[] = $avaialbe; 25 } 26 22 27 } 23 28 echo implode(' ', $params); … … 25 30 </td> 26 31 <td> 32 <?php if ($code['active'] !== null) : ?> 27 33 <input type="checkbox" value="1" name="<?php echo $name; ?>[active]" <?php echo $code['active'] ? 'checked="checked"' : '';?>/> 34 <?php endif; ?> 28 35 </td> 29 36 </tr> -
2kb-amazon-affiliates-store/trunk/template/default/css/style.css
r1119725 r1128309 482 482 width: 100%; 483 483 z-index: 1000; 484 } 485 .kb-amz-product-shortcode{ 486 border: none!important; 487 } 488 .kb-amz-product-shortcode td{ 489 vertical-align: top; 490 } 491 .kb-amz-product-header-shortcode{ 492 font-size: 10pt; 493 line-height: 1.25; 494 margin: 0 0 5px; 495 } 496 .kb-amz-product-header-shortcode a{ 497 line-height: inherit; 498 } 499 .kb-amz-product-image-shortcode{ 500 max-width: 160px; 501 padding-right: 20px!important; 502 } 503 .kb-amz-product-image-shortcode img 504 { 505 border: none; 506 margin: 0; 507 padding: 0; 508 outline: none; 509 } 510 .kb-amz-product-shortcode .kb-product-attributes 511 { 512 line-height: 1.2; 513 } 514 .kb-amz-product-shortcode .kb-product-attribute-label 515 { 516 font-size: 0.8em; 484 517 } 485 518 /*TB*/
Note: See TracChangeset
for help on using the changeset viewer.