Changeset 3327281
- Timestamp:
- 07/14/2025 05:04:47 AM (7 months ago)
- Location:
- mergado-marketing-pack/trunk
- Files:
-
- 9 edited
-
README.txt (modified) (2 diffs)
-
admin/templates/partials/tabs-adsys/adsys-biano.php (modified) (1 diff)
-
mergado-marketing-pack.php (modified) (2 diffs)
-
src/Feed/Product/ProductFeed.php (modified) (5 diffs)
-
src/Feed/Product/ProductFeedItem.php (modified) (3 diffs)
-
src/Helper/ProductDetailRequestHelper.php (modified) (1 diff)
-
src/Service/External/Biano/BianoService.php (modified) (2 diffs)
-
src/Service/External/Biano/BianoServiceIntegration.php (modified) (3 diffs)
-
src/Service/External/Biano/templates/initDefault.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mergado-marketing-pack/trunk/README.txt
r3292430 r3327281 1 1 === Mergado Pack === 2 Stable tag: 4. 1.22 Stable tag: 4.2.0 3 3 Contributors: mergado 4 4 Donate link: https://pack.mergado.com/woocommerce … … 269 269 == Changelog == 270 270 271 = 4.2.0 = 272 * NEW: Product feed - Brand element implemented 273 * NEW: Biano - new languages/countries implemented - [BG, GR, PL, IT, PT] 274 * IMPROVEMENT: Product feed - include description and short description for special product types 275 271 276 = 4.1.2 = 272 277 * FIX: Product Feed – Resolved an issue where feeds failed to generate for products in certain category configurations -
mergado-marketing-pack/trunk/admin/templates/partials/tabs-adsys/adsys-biano.php
r3185508 r3327281 28 28 29 29 <?php 30 foreach (BianoService::LANGUAGES as $lang ):30 foreach (BianoService::LANGUAGES as $lang => $domain): 31 31 $activeLangName = BianoService::getActiveLangName($lang); 32 32 $activeMerchantId = BianoService::getMerchantIdName($lang); -
mergado-marketing-pack/trunk/mergado-marketing-pack.php
r3292430 r3327281 17 17 * Plugin URI: https://www.mergado.cz 18 18 * Description: Earn more on price comparator sites. <strong>REQUIRES: Woocommerce</strong> 19 * Version: 4. 1.219 * Version: 4.2.0 20 20 * Author: Mergado technologies, s. r. o. 21 21 * Author URI: https://www.mergado.cz … … 46 46 } 47 47 48 define('PLUGIN_VERSION', '4. 1.2');48 define('PLUGIN_VERSION', '4.2.0'); 49 49 define( '__MERGADO_DIR__', plugin_dir_path( __FILE__ ) ); 50 50 define( '__MERGADO_BASE_FILE__', plugin_dir_path( __FILE__ ) . 'mergado-marketing-pack.php' ); -
mergado-marketing-pack/trunk/src/Feed/Product/ProductFeed.php
r3292430 r3327281 359 359 $productFeedItem->setCategory($categories['category']); 360 360 $productFeedItem->setCategoriesAlternative($categories['alternative_categories']); 361 $productFeedItem->setBrands($this->getProductBrands($v['id'])); 361 362 362 363 $productFeedItem->setTags($this->getTags($productObject)); … … 402 403 403 404 $categories = $this->getCategories($category_ids); 405 $productFeedItem->setBrands($this->getProductBrands($parentObject->get_id())); 404 406 } else { 405 407 $categories = ['category' => '', 'alternative_categories' => []]; … … 408 410 $productFeedItem->setCategory($categories['category']); 409 411 $productFeedItem->setCategoriesAlternative($categories['alternative_categories']); 412 410 413 $productFeedItem->setTags($this->getTags($parentObject)); 411 414 … … 450 453 if ($productSizes['weight'] != "") { 451 454 $productFeedItem->setShippingWeight(sprintf('%s %s', $productSizes['weight'], $weightUnit)); 455 } 456 } else { 457 // Universal description for other types 458 if ($description = $productObject->get_description()) { 459 $productFeedItem->setDescription($description); 460 } 461 462 if ($shortDescription = $productObject->get_short_description()) { 463 $productFeedItem->setDescriptionShort($shortDescription); 464 } 465 466 if ($v['id']) { 467 $productFeedItem->setBrands($this->getProductBrands($v['id'])); 452 468 } 453 469 } … … 694 710 } 695 711 712 protected function getProductBrands($productId): array 713 { 714 $brands = get_the_terms( $productId, 'product_brand' ); 715 716 if ( is_wp_error($brands) || empty($brands) ) { 717 return []; 718 } 719 720 return $this->getFullBrandChains($brands); 721 } 722 723 protected function getFullBrandChains($brands): array 724 { 725 // Create a lookup array for quick parent finding 726 $brandLookup = []; 727 foreach ($brands as $brand) { 728 $brandLookup[$brand->term_id] = $brand; 729 } 730 731 // Find leaf nodes (brands that are not parents of any other brand) 732 $parentIds = []; 733 foreach ($brands as $brand) { 734 if ($brand->parent != 0) { 735 $parentIds[] = $brand->parent; 736 } 737 } 738 739 $leafBrands = []; 740 foreach ($brands as $brand) { 741 if (!in_array($brand->term_id, $parentIds)) { 742 $leafBrands[] = $brand; 743 } 744 } 745 746 $fullChains = []; 747 foreach ($leafBrands as $brand) { 748 $visited = []; 749 $chain = $this->buildChain($brand, $brandLookup, $visited); 750 $fullChains[] = implode(' | ', $chain); 751 } 752 753 return $fullChains; 754 } 755 756 protected function buildChain($brand, $brandLookup, &$visited = []): array 757 { 758 if (in_array($brand->term_id, $visited)) { 759 return [$brand->name]; 760 } 761 762 $visited[] = $brand->term_id; 763 $chain = [$brand->name]; 764 765 if ($brand->parent != 0 && isset($brandLookup[$brand->parent])) { 766 $parentChain = $this->buildChain($brandLookup[$brand->parent], $brandLookup, $visited); 767 $chain = array_merge($parentChain, $chain); 768 } 769 770 return $chain; 771 } 772 696 773 protected function getCategories($categoryIds): array 697 774 { -
mergado-marketing-pack/trunk/src/Feed/Product/ProductFeedItem.php
r3292430 r3327281 42 42 public $visibility; 43 43 public $catalogVisibility; 44 public $brands = []; 44 45 45 46 private $productType; … … 540 541 { 541 542 $this->categoriesAlternative = $categories; 543 } 544 545 /** 546 * @return array 547 */ 548 public function getBrands(): array 549 { 550 return $this->brands; 551 } 552 553 /** 554 * @param array $brands 555 */ 556 public function setBrands(array $brands): void 557 { 558 $this->brands = $brands; 542 559 } 543 560 … … 569 586 } 570 587 588 foreach($this->getBrands() as $brands) { 589 $this->createXmlItemProperty($item, 'BRAND', $brands, true); 590 } 591 571 592 $this->createXmlItemProperty($item, 'EAN', $this->getEan()); 572 593 $this->createXmlItemProperty($item, 'SHIPPING_SIZE', $this->getShippingSize()); -
mergado-marketing-pack/trunk/src/Helper/ProductDetailRequestHelper.php
r3192320 r3327281 69 69 } 70 70 71 // Fix for older instal lations where global product may be string71 // Fix for older instalations where global product may be string 72 72 if ( ! is_object( $product ) ) { 73 73 $product = wc_get_product( get_the_ID() ); -
mergado-marketing-pack/trunk/src/Service/External/Biano/BianoService.php
r3185508 r3327281 26 26 public const MERCHANT_ID = 'biano_merchant_id'; 27 27 public const ACTIVE_LANG = 'biano-form-active-lang'; 28 public const LANGUAGES = ['CZ', 'SK', 'RO', 'NL', 'HU']; 28 public const LANGUAGES = [ 29 'CZ' => 'cz', 30 'SK' => 'sk', 31 'RO' => 'ro', 32 'NL' => 'nl', 33 'HU' => 'hu', 34 'BG' => 'bg', 35 'GR' => 'gr', 36 'PL' => 'com/pl', 37 'IT' => 'it', 38 'PT' => 'pt', 39 ]; 29 40 public const CONVERSION_VAT_INCL = 'biano-vat-included'; 30 41 public const COMPOSITE_ID_ENABLED = 'mmp-biano-composite-id-enabled'; … … 114 125 115 126 foreach (self::LANGUAGES as $key => $item) { 116 $inputs[] = self::getMerchantIdName($ item);117 $checkboxes[] = self::getActiveLangName($ item);127 $inputs[] = self::getMerchantIdName($key); 128 $checkboxes[] = self::getActiveLangName($key); 118 129 } 119 130 -
mergado-marketing-pack/trunk/src/Service/External/Biano/BianoServiceIntegration.php
r3192320 r3327281 59 59 60 60 // Default solution 61 if ( in_array($this->lang, BianoService::LANGUAGES)) {61 if (array_key_exists($this->lang, BianoService::LANGUAGES)) { 62 62 63 63 $templateVariables = [ 64 64 'merchantId' => $merchantId, 65 65 'consent' => $this->cookieService->advertisementEnabled() ? 'true' : 'false', 66 ' lang' => strtolower($this->lang)66 'domain' => BianoService::LANGUAGES[$this->lang] 67 67 ]; 68 68 … … 207 207 // Biano star 208 208 $bianoStarServiceIntegration = BianoStarServiceIntegration::getInstance(); 209 $bianoStarShould eBeSent = $bianoStarServiceIntegration->shouldBeSent($orderId);209 $bianoStarShouldBeSent = $bianoStarServiceIntegration->shouldBeSent($orderId); 210 210 211 211 $templatePath = __DIR__ . '/templates/purchase.php'; … … 216 216 'currency' => $order->get_currency(), 217 217 'items' => json_encode($products, JSON_NUMERIC_CHECK), 218 'bianoStarShouldBeSent' => $bianoStarShould eBeSent218 'bianoStarShouldBeSent' => $bianoStarShouldBeSent 219 219 ]; 220 220 221 221 222 if ($bianoStarShould eBeSent) {222 if ($bianoStarShouldBeSent) { 223 223 $bianoStarService = $bianoStarServiceIntegration->getService(); 224 224 -
mergado-marketing-pack/trunk/src/Service/External/Biano/templates/initDefault.php
r3001192 r3327281 5 5 }; 6 6 7 const biano Language = '<?php echo $lang; ?>';7 const bianoDomain = '<?php echo $domain; ?>'; 8 8 9 9 !function (b, i, a, n, o, p, x, s) { … … 21 21 p = i.createElement(s); 22 22 p.async = !0; 23 p.src = 'https://' + (n ? 'pixel.biano.' + biano Language: 'bianopixel.com') +23 p.src = 'https://' + (n ? 'pixel.biano.' + bianoDomain : 'bianopixel.com') + 24 24 '/' + (a.debug ? 'debug' : 'min') + '/pixel.js'; 25 25 x = i.getElementsByTagName(s)[0];
Note: See TracChangeset
for help on using the changeset viewer.