Skip to content

Commit

Permalink
Merge beta in master (#170)
Browse files Browse the repository at this point in the history
* chore: Added semantic release (#158)

* chore: Added semantic release

* chore: Added develop branch to semantic release

* chore: Set beta branch as prerelease branch

* chore: Only trigger release workflow for master and beta branch (#160)

* chore: Updated README for semantic release

* Merge master back to beta branch (#165)

* Prevent duplicate slug values (#159)

Prevent duplicate slug values

* Fix notice missing variables (#157)

* Bump version

* chore: Added semantic release (#158)

* chore: Added semantic release

* chore: Added develop branch to semantic release

* chore: Set beta branch as prerelease branch

* chore: Only trigger release workflow for master and beta branch (#160)

* chore: Updated README for semantic release

---------

Co-authored-by: Tjeu Jansen <161043478+jansentjeu@users.noreply.github.com>
Co-authored-by: tjeujansen <tjansen@emico.nl>

* chore: Added Youwe Testing Suite

* chore: Added Magento secrets in testing suite action

* chore: Fixed phpmd linter

* chore: Run grumphp directly with PHP

* perf: Applied phpcs and phpmd rules

BREAKING CHANGE: Code is refactored based on phpcs and phpmd rules.

* Fixed phpcs issues in AttributeSlugRepository

* chore(release): 6.0.0-beta.1 [skip ci]

# [6.0.0-beta.1](v5.8.3...v6.0.0-beta.1) (2024-03-29)

### Performance Improvements

* Applied phpcs and phpmd rules ([9a499fd](9a499fd))

### BREAKING CHANGES

* Code is refactored based on phpcs and phpmd rules.

* feat: searchable filters (#166)

When the filtersearch option is enabled within Tweakwise for a specific filter in the filter template, a search box will now appear above the filter. This search box allows users to conveniently search through the filter values associated with that particular filter.

In cases where no filters are found, the designated text for displaying no results as configured in Tweakwise will be shown.

Additionally, users have the option to specify placeholder text for the search box within Tweakwise.

These modifications have been implemented within the default filter view. If you have customized your own view, please ensure to incorporate these changes accordingly.

* chore(release): 6.0.0-beta.2 [skip ci]

# [6.0.0-beta.2](v6.0.0-beta.1...v6.0.0-beta.2) (2024-04-09)

### Features

* searchable filters ([#166](#166)) ([bebd6c6](bebd6c6))

* Fix spacing

* Add filterpath to url if url no filter exists (#169)

* Bump version nr

---------

Co-authored-by: Tjeu Jansen <161043478+jansentjeu@users.noreply.github.com>
Co-authored-by: tjeujansen <tjansen@emico.nl>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
  • Loading branch information
4 people committed Apr 10, 2024
1 parent a476ef2 commit bbc20f7
Show file tree
Hide file tree
Showing 181 changed files with 1,252 additions and 540 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/testing-suite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Testing Suite
on: [push]
jobs:
linter:
strategy:
matrix:
image: [
'srcoder/development-php:php82-fpm'
]
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Testing Suite
run: |
composer2 config http-basic.repo.magento.com ${{ secrets.MAGENTO_USERNAME }} ${{ secrets.MAGENTO_PASSWORD }}
composer2 install --dev --prefer-dist --no-scripts --no-progress --optimize-autoloader --no-interaction -vvv
composer2 show
vendor/bin/grumphp run --no-interaction
shell: bash
10 changes: 8 additions & 2 deletions Block/Autocomplete/FormMini.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Tweakwise (https://www.tweakwise.com/) - All Rights Reserved
*
Expand Down Expand Up @@ -40,8 +41,13 @@ class FormMini extends Template
* @param Context $context
* @param array $data
*/
public function __construct(Config $config, LocaleFormat $localeFormat, Registry $registry, Context $context, array $data = [])
{
public function __construct(
Config $config,
LocaleFormat $localeFormat,
Registry $registry,
Context $context,
array $data = []
) {
parent::__construct($context, $data);

$this->config = $config;
Expand Down
27 changes: 18 additions & 9 deletions Block/Cart/Crosssell/Plugin.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Tweakwise (https://www.tweakwise.com/) - All Rights Reserved
*
Expand All @@ -16,6 +17,7 @@
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Registry;
use Tweakwise\Magento2Tweakwise\Model\Catalog\Product\Recommendation\Collection;
use Tweakwise\Magento2Tweakwise\Model\Catalog\Product\Recommendation\Context as RecommendationsContext;
use Tweakwise\Magento2Tweakwise\Block\Catalog\Product\ProductList\AbstractRecommendationPlugin;
use Tweakwise\Magento2Tweakwise\Exception\ApiException;
Expand Down Expand Up @@ -66,8 +68,7 @@ public function __construct(
Session $checkoutSession,
RecommendationsContext $recommendationsContext,
?ProductRepositoryInterface $productRepository = null
)
{
) {
$this->productRepository = $productRepository;
$this->checkoutSession = $checkoutSession;
$this->recommendationsContext = $recommendationsContext;
Expand All @@ -94,6 +95,7 @@ protected function getType()
/**
* Get the last added product before running the default getItems because the last added products gets deleted from the session
*
* @param Crosssell $crosssell
* @param Closure $proceed
* @return array
*/
Expand Down Expand Up @@ -124,6 +126,7 @@ private function getLastAddedProduct(): ?ProductInterface
$product = null;
}
}

return $product;
}

Expand All @@ -139,7 +142,7 @@ protected function _getLastAddedProductId()

/**
* @param Crosssell $crosssell
* @param $result
* @param array $result
* @return array
*/
public function afterGetItems(Crosssell $crosssell, $result)
Expand All @@ -166,7 +169,11 @@ private function getShoppingcartCrosssellItems(array $cartProductIds, array $res

if ($cartProductIds) {
if ($this->lastAddedProduct) {
$items = $this->getShoppingcartCrosssellTweakwiseItems($this->lastAddedProduct, $result, $cartProductIds);
$items = $this->getShoppingcartCrosssellTweakwiseItems(
$this->lastAddedProduct,
$result,
$cartProductIds
);
}

if (empty($items)) {
Expand Down Expand Up @@ -197,7 +204,8 @@ private function getShoppingcartCrosssellItems(array $cartProductIds, array $res
* @param array $cartItems
* @return array
*/
private function getShoppingcartCrosssellTweakwiseItems (ProductInterface $product, array $result, array $cartItems) {
private function getShoppingcartCrosssellTweakwiseItems(ProductInterface $product, array $result, array $cartItems)
{
$items = [];

//show featured products
Expand Down Expand Up @@ -235,19 +243,20 @@ private function getShoppingcartCrosssellTweakwiseItems (ProductInterface $produ
}

/**
* @param $collection
* @param $filteredProducts
* @return void
* @param Collection $collection
* @param array $cartItems
* @return array
*/
protected function removeCartItems($collection, $cartItems)
{
$items = $collection->getItems();

if(!empty($cartItems)) {
if (!empty($cartItems)) {
foreach ($cartItems as $cartItem) {
unset($items[$cartItem]);
}
}

return $items;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct(Config $config, Registry $registry, Context $context
/**
* @return string
*/
protected abstract function getType();
abstract protected function getType();

/**
* @param ProductRequest $request
Expand All @@ -75,6 +75,7 @@ protected function configureRequest(ProductRequest $request)

/**
* @return Collection
* @throws InvalidArgumentException
*/
protected function getCollection()
{
Expand Down
11 changes: 3 additions & 8 deletions Block/Catalog/Product/ProductList/Featured.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Tweakwise (https://www.tweakwise.com/) - All Rights Reserved
*
Expand All @@ -23,13 +24,6 @@
use Magento\Framework\Data\Helper\PostHelper;
use Magento\Framework\Url\Helper\Data;

/**
* Class Featured
*
* @package Tweakwise\Magento2Tweakwise\Block\Catalog\Product\ProductList
*
* @method string getRenderLocation();
*/
class Featured extends ListProduct
{
/**
Expand Down Expand Up @@ -122,6 +116,7 @@ public function toHtml()
if (!$this->getData('view_model') && $this->preparePostDataFactory->getPreparePostData()) {
$this->setData('view_model', $this->preparePostDataFactory->getPreparePostData());
}

try {
$this->_getProductCollection();
} catch (ApiException $e) {
Expand Down Expand Up @@ -159,7 +154,7 @@ protected function checkRecommendationEnabled(): bool
}

/**
* @param $request
* @param FeaturedRequest $request
*/
protected function configureRequest(FeaturedRequest $request)
{
Expand Down
9 changes: 5 additions & 4 deletions Block/Catalog/Product/ProductList/Plugin.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Tweakwise (https://www.tweakwise.com/) - All Rights Reserved
*
Expand All @@ -11,10 +12,10 @@
class Plugin
{
/**
* Retrieve additional blocks html
*
* @return string
*/
* Retrieve additional blocks html
*
* @return string
*/
public function afterGetAdditionalHtml($subject, $result)
{
$searchBanner = $subject->getBlockHtml('navigation.search.banner.products.top');
Expand Down
2 changes: 2 additions & 0 deletions Block/Catalog/Product/ProductList/Related/Plugin.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Tweakwise (https://www.tweakwise.com/) - All Rights Reserved
*
Expand Down Expand Up @@ -34,6 +35,7 @@ public function aroundGetItems(Related $subject, Closure $proceed)
if (!$this->config->isRecommendationsEnabled(Config::RECOMMENDATION_TYPE_CROSSSELL)) {
return $proceed();
}

if (!$this->templateFinder->forProduct($subject->getProduct(), $this->getType())) {
return $proceed();
}
Expand Down
9 changes: 5 additions & 4 deletions Block/Catalog/Product/ProductList/Toolbar/Plugin.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Tweakwise (https://www.tweakwise.com/) - All Rights Reserved
*
Expand All @@ -8,7 +9,6 @@

namespace Tweakwise\Magento2Tweakwise\Block\Catalog\Product\ProductList\Toolbar;


use Closure;
use Magento\CatalogInventory\Api\StockConfigurationInterface;
use Magento\Framework\Exception\LocalizedException;
Expand Down Expand Up @@ -90,6 +90,7 @@ public function aroundGetAvailableOrders(Toolbar $subject, Closure $proceed)
foreach ($sortFields as $field) {
$result[$field->getUrlValue()] = $field->getDisplayTitle();
}

return $result;
}

Expand All @@ -109,12 +110,13 @@ public function afterGetWidgetOptionsJson(Toolbar $subject, string $result)

return json_encode($options);
}

/**
* Update toolbar count if store is in single source mode
* Used in the commerce version
*
* @param Toolbar $subject
* @param int $result
* @param callable $proceed
* @return int
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @throws LocalizedException
Expand All @@ -134,8 +136,7 @@ public function aroundGetTotalNum(Toolbar $subject, callable $proceed): int
}
}

if (!isset($result))
{
if (!isset($result)) {
return $proceed();
}

Expand Down
2 changes: 2 additions & 0 deletions Block/Catalog/Product/ProductList/Upsell/Plugin.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Tweakwise (https://www.tweakwise.com/) - All Rights Reserved
*
Expand Down Expand Up @@ -35,6 +36,7 @@ public function aroundGetItemCollection(Upsell $subject, Closure $proceed)
if (!$this->config->isRecommendationsEnabled(Config::RECOMMENDATION_TYPE_UPSELL)) {
return $proceed();
}

if (!$this->templateFinder->forProduct($subject->getProduct(), $this->getType())) {
return $proceed();
}
Expand Down
11 changes: 2 additions & 9 deletions Block/Catalog/Product/Widget/FeaturedProducts.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Tweakwise (https://www.tweakwise.com/) - All Rights Reserved
*
Expand All @@ -13,14 +14,6 @@
use Tweakwise\Magento2Tweakwise\Model\Client\Request\Recommendations\FeaturedRequest;
use Magento\Widget\Block\BlockInterface;

/**
* Class FeaturedProducts
*
* @package Tweakwise\Magento2Tweakwise\Block\Catalog\Product\Widget
* @method int getRuleId();
* @method string getDisplayType();
* @method bool getCanItemsAddToCart();
*/
class FeaturedProducts extends Featured implements BlockInterface
{
/**
Expand All @@ -41,7 +34,7 @@ protected function checkRecommendationEnabled(): bool
}

/**
* @param $request
* @param FeaturedRequest $request
*/
protected function configureRequest(FeaturedRequest $request)
{
Expand Down

0 comments on commit bbc20f7

Please sign in to comment.