clerkio / clerk-magento2 Goto Github PK
View Code? Open in Web Editor NEWMagento 2 extension for Clerk.io
License: MIT License
Magento 2 extension for Clerk.io
License: MIT License
Hi, is this module fully compatible with magento 2.4.2 and latest versions of PHP 7.4?
Sorry but I cannot find any information on the web and on Clerk docs.
Thanks!
Hi
We have this very weird issue, it requires visiting a category url that has no url rewrite
When we do this, we can see that the ajax call to clerk/powerstep/popup
gives us back the entire html dom of the category page and inserts it again underneath the already existing page. Which causes the page's DOM being duplicated entirely and we have two times the header, menu, products, footer, ...
Seen with:
Steps to reproduce:
https://domain.example/{storeview_code}/catalog/category/view/s/{category-url-key}/id/{category-entity-id}/
(you can probably quickly simulate this by removing url rewrites for this category from the url_rewrite
database table and flushing your cache and then clicking on that category in the menuThis is not happening when a category has a "nice" url from the url rewrites.
We are currently investigating on this shop why certain categories do not have such an url, and are going to fix this, but this is a weird side effect we noticed and thought it might be a good idea to at least document it publicly in case somebody else runs into this as well.
Not sure if it makes sense to try to fix this, I'll leave that up to you to decide.
Thanks!
This module does not allow an upgrade to Magento 2.2.0 as the dependency on the Magento Framework is for 100.1* where as Magento 2.2.0 uses the framework 101.0.*
Is there any plans to upgrade this to allow it to be used with Magento 2.2.0 versions?
Hi
on some old Magento2 installation you can obtain error like this while running a setup:di:compile
vendor/clerkio/magento2/Controller/Page/Index.php \Magento\Framework\ObjectManagerInterface already exists in context object
Currently we have events in adminhtml
area only. When products are created and updated via REST API, e.g. POST https://example.com/rest/all/V1/products
, Clerk will not receive any update.
Solutions:
a. either move event observers to global di.xml
b. grown up solution is indexer with update on save/update by schedule mode
I am a strong proponent of option b. because it has proven an industry standard with numerous projects we worked with. I made a PR before (#13), however, we should simplify it and update.
But either choice will be a step forward.
Please have a look :)
Issue is for both Magento1 and Magento2
Issue:
In clerk setting, Faceted Search multiselect is empty
Problem:
Source model is filled using clerk api "product/faceted".
Response is huge because it loads all attributes for all products (even skus)
Here's the sourcemodel
<source_model>clerk/system_config_source_facetAttributes</source_model>
Proposed solution:
We should use Magento's attributes having "Use for layered in search" set to yes. (And we should add such attributes automatically into products feed)
"Trying to get property on non-object"
In Observer/ProductSaveEntityAfterObserver.php function execute, line 87
$productItem[$field] = $productItem->getData[$field];
should be
$productItem[$field] = $product->getData($field);
We have installed version 3.0.0 in Magento 2.3.2 and are facing the following issues. There is a bug in the Javascript loading from clerk.io.
Powerstep popup does not load correctly on add to cart function. The powerstep popup loads at the buttom of the page in stead of as a popup window
Powerpage can only load one slider. IF you add more than one slider with product recommendations only the first content/design will load as a slider - the rest is loading in a grid.
We have a case where the module must be disabled for a second website in Magento 2. But the tracking.phtml is still loading en gives a JS error for invalid API key.
https://github.com/clerkio/clerk-magento2/blob/master/view/frontend/layout/default.xml#L9
Hi guys
Using:
It looks like there are 2 incorrect namespaces in your PHP code, these can be found by dumping an optimised autoloader from composer:
$ composer dump-autoload -o
...
Class Clerk\Clerk\Controller\setconfig\Index located in ./vendor/clerk/magento2/Controller/Setconfig/Index.php does not comply with psr-4 autoloading standard. Skipping.
Class Clerk\Clerk\Controller\Subcriber\Index located in ./vendor/clerk/magento2/Controller/Subscriber/Index.php does not comply with psr-4 autoloading standard. Skipping.
Setconfig
instead of setconfig
Subscriber
instead of Subcriber
I haven't checked if you are using these incorrect namespaces in other classes, so please make sure you check that as well 🙂
Also: make sure to dump a non-optimised autoloader (composer dump-autoload
) after fixing the problems before you want to test things, because Magento can't deal very well with optimised autoloaders in developer mode.
In template file:
https://github.com/clerkio/clerk-magento2/blob/master/view/frontend/templates/livesearch.phtml#L22
you have JavaScript issue which is making conflicts with existing magento logic. You are loading wrong version of jquery from url: https://code.jquery.com/jquery-3.4.1.min.js
and you are not using require js for loading scripts.
This is not Magento way:
`<script type="text/javascript">
document.addEventListener('DOMContentLoaded', (event) => {
ClerkSearchPage = function(){
$("getFormSelector(); ?>").each(function (){
$(this).attr('action', '/catalogsearch/result/');
});
};
if(window.jQuery) $( document ).ready(function() { ClerkSearchPage() });
else{
var script = document.createElement('script');
document.head.appendChild(script);
script.type = 'text/javascript';
script.src = "https://code.jquery.com/jquery-3.4.1.min.js";
script.integrity = "sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=";
script.crossorigin = "anonymous";
script.onload = ClerkSearchPage;
}
});
</script>`
Hi guys,
We noticed an error in the console log that causes issues in the security of the webshop (probably by receiving a 403 response.)
Magento 2.3.4
Clerk module v3.3.2 (also in 3.4.1 and 4.0.0)
When a product is listed in one of the widgets on for example a widget with template Best Sellers that doesn't have a picture linked to it, we get the following error in the console:
VM1470:691 GET https://baseurl.something/media/catalog/product/ 403 Forbidden
Using the default placeholder for products without predefined images.
base media path used as and console log thrown on the frontend
Magento : 2.3.2
run Magento command to create / edit product but got issue on non SERVER env
File https://github.com/clerkio/clerk-magento2/blob/master/Controller/Logger/ClerkLogger.php
Should be
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' && isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) $Metadata['uri'] = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; else if(isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) { $Metadata['uri'] = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; }
When I save any products I receive this message:
Notice: Undefined property: Magento\Catalog\Model\Product\Interceptor::$getData in /var/www/my_website/public_html/vendor/clerk/magento2/Observer/ProductSaveEntityAfterObserver.php on line 87
Which refers to the fact that $productItem is empty:
if (! isset($productItem[$field])) { $productItem[$field] = $product->getData[$field]; }
I could hide E_NOTICE from php.ini but I think that it would be better to fix it.
Magento 2.1.7
Stores > Config > Clerk
Set Use Real-time Updates to "Yes" (By default It`s enabled in config)
On product delete Magento down wIth report/warning:
a:4:{i:0;s:124:"Warning: join(): Invalid arguments passed in /var/www/magento2/vendor/clerk/magento2/Model/Api.php on line 67";i:1;s:11462:"#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'join(): Invalid...', '/var/www/mage...', 67, Array)
#1 /var/www/magento2/vendor/clerk/magento2/Model/Api.php(67): join(',', '1')
#2 /var/www/magento2/vendor/clerk/magento2/Observer/ProductDeleteAfterDoneObserver.php(41): Clerk\Clerk\Model\Api->removeProduct('1')
#3 /var/www/magento2/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73): Clerk\Clerk\Observer\ProductDeleteAfterDoneObserver->execute(Object(Magento\Framework\Event\Observer))
Product should be deleted without errors
The issue is related with join function and removeProduct waits array instead string. Please fix method and remove join() , because We not use it with arrays at all and use only one value per product : https://github.com/clerkio/clerk-magento2/blob/master/Model/Api.php#L62
Hey guys
Using:
If you have a category tree with more than one level of categories, your powerstep popup fails to show on categories which are a subcategory of another category.
That's because the url in the ajax request is not using a urlbuilder to make it absolute, now it remains relative and causes issues.
For example, suppose I'm on the page: https://example.shop/nl/category-one and I trigger the powerstep popup, it will do an ajax call to https://example.shop/nl/clerk/powerstep/popup which is correct!
However, when you are on the page: https://example.shop/nl/category-one/category-two and trigger the powerstep popup, it will do an ajax call to https://example.shop/nl/category-one/clerk/powerstep/popup which won't work!
Suggested fix:
diff --git a/powerstep_script.phtml b/powerstep_script.phtml
index cced4b6..852a2a2 100644
--- a/powerstep_script.phtml
+++ b/powerstep_script.phtml
@@ -3,14 +3,14 @@
if ($block->shouldShow()) :
?>
<script>
-require(['jquery'], function($) {
+require(['jquery', 'mage/url'], function($, urlBuilder) {
function getPowerstepPopup(isAjax)
{
$("#clerk_powerstep").remove();
$("#clerk_powerstep .clerk-slider").remove();
var data = isAjax ? { isAjax: true } : {};
$.ajax({
- url: 'clerk/powerstep/popup',
+ url: urlBuilder.build('clerk/powerstep/popup'),
data: data,
type: 'get',
success: function(res) {
Thanks!
Version: 3.4.1
PHP Fatal error: Uncaught Error: Call to a member function log() on null in vendor/clerk/magento2/Controller/AbstractAction.php:338
Stack trace:
#0 vendor/magento/framework/App/Action/Action.php(108): Clerk\Clerk\Controller\AbstractAction->execute()
#1 vendor/clerk/magento2/Controller/AbstractAction.php(160): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#2 vendor/magento/framework/Interception/Interceptor.php(58): Clerk\Clerk\Controller\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#3 vendor/magento/framework/Interception/Interceptor.php(138): Clerk\Clerk\Controller\Customer\Index\Interceptor->___callParent('dispatch', Array)
#4 vendor/magento/framework/Interception/Interceptor.php(153): Clerk\Clerk\Contro in vendor/clerk/magento2/Controller/AbstractAction.php on line 338
i see that you have fixed this issue in the new major version but im not sure that it's a good idea to restrict a fix for a fatel error to going to a now major verison, so maybe we can get a 3.4.2 version which fixes this issue in the same manor as the 4.0.0 version does.
Hi!
With latest version 4 of the module, all configuration was moved to website/store view level.
It is now impossible to set faceted settings:
This happens because code tries to check API keys on default scope level, which is now impossible to set.
I suggest that maybe API keys are returned to default visibility.
Thanks!
As described here, #12
Out of stock products are not skipped and removed from Clerk, it will dispayed in sliders, email, reccom and search page.
As I correctly config Saelable product It will be ignored.
As out of stock is yet a product attribute or quantity I dont' understand why add extra field to my magento as described here
My config:
Magento 2.2.6
PhP 7.1.22
clerk-magento2 v2.6.8
Hope It will solve asap
------EDIT------
Forget to say that hidden Categories are displayed in search page
Login, registration and forgot password pages appear to be duplicated (html of the whole page, header and footer included, is rendered twice), and there is this error in javascript console:
The origin of this error is in file vendor/clerk/magento2/view/frontend/templates/powerstep_script.phtml
, line 6.
The login page is correctly displayed, and there are no javascript errors in console
### Actual behaviour
The login page displayed twice (the whole page is duplicated, header and footer included) and there is this error in javascript console:
See the subject: https://packagist.org/packages/clerk/magento2
Since these lines has been added to Model/Adapter/AbstractAdapter.php
:
attributes with no values in Magento are sent to Clerk as empty string. Maybe it's not even a bug, but if it's the desired behavior, I'd like to know if there is a specific reason for which it has been made. Maybe it solves some other issue?
I can see product attributes with a value.
I can see all product attributes, also empty ones.
Hi!
A lot of Magento webshops receive updates via API from Product information management systems. In this case event catalog_product_save_after
will not fire call Clerk\Clerk\Observer\ProductSaveAfterObserver , because it is declared in adminhtml area.
Related with #13
Suggestions:
Thanks :)
P.S. Looking forward to another 2 years of silence ;)
PHP Fatal error: Uncaught Error: Call to a member function getImage() on boolean in /my/project/path/vendor/clerk/magento2/Block/PowerstepPopup.php:116
This happens because add to cart fails, event checkout_cart_add_product_complete is not dispatched, so CheckoutCartAddProductCompleteObserver in never executed, and clerkProductId is never set in checkoutSession.
I am testing the Perfomance Score of my Magento 2 in development and without Clerk it is 86% in Gtmetrix but with Clerk it is 24% for two reasons, Serve scaled images and Optimize images https://gtmetrix.com/reports/www .vendetucasaenchina.com / gm31GxFJ
In my Magento 1 this does not happen to me.
Could you check if there is a problem with your code in Magento 2?
Hey guys
Using:
We sometimes had a problem closing the powerstep popup after it was opened, this was not consistent, sometimes it worked, sometimes after a refresh or another page visit, it didn't, and so on and so forth ...
For some reason, when we removed the 'clerk'
dependency in this script: https://github.com/clerkio/clerk-magento2/blob/4.6.1/view/frontend/templates/powerstep_popup.phtml#L59, it started working 100% of the time.
I can't really explain it, I think it also has something to do with minifying of JS which is enabled on this particular shop, but I'm mostly guessing here.
I think that dependency can be removed completely, since the Clerk
object is not used anywhere in that script block.
It did get used in the past, but that usage was removed with 276f489#diff-4d9bb2c884794ef6c353a9d2a1713725d0ea4668b03b2a7a5e4f1d79d92cce3f, so I'm pretty sure it's no longer needed.
Suggested fix:
diff --git a/view/frontend/templates/powerstep_popup.phtml b/view/frontend/templates/powerstep_popup.phtml
index 53e149f..21f6610 100644
--- a/view/frontend/templates/powerstep_popup.phtml
+++ b/view/frontend/templates/powerstep_popup.phtml
@@ -56,7 +56,7 @@ $categoryIds = $block->getProduct() ? $block->getProduct()->getCategoryIds() : [
</div>
</div>
<script>
-require(['jquery', 'clerk'], function($, Clerk) {
+require(['jquery'], function($) {
var popup = $("#clerk_powerstep");
$(".clerk_powerstep_close").on("click", function() {
Hi!
After recent changes with configuration scope (never default), content setting is ignored. I think this is because store view level is not passed when reading configuration.
This results in data-template="@" - incorrect value, no matter what is selected in admin.
Hi. It seems that in Magento 2.4.3 this line(20) in file clerk/magento2/view/frontend/templates/tracking.phtml throws error:
uenc: '<?php echo base64_encode((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); ?>',
Error is in logs:
report.ERROR: Notice: Undefined index: HTTP_HOST in clerk/magento2/view/frontend/templates/tracking.phtml on line 20
Any help please?
Can you add installation steps (composer?)
to the readme
something like this https://github.com/Adyen/adyen-magento2/blob/develop/README.md
Hi!
After module review I found some problem to add custom field based on some logic of another module. On M1 version I found event https://github.com/clerkio/clerk-magento/blob/master/code/Model/Catalog/Product.php#L50 and It`s good point to extending.
On M2 You use the same way as for Prestashop:
https://help.clerk.io/using-clerk-io-on-magento-2/styling-and-design/styling-clerkio-results-to-match-your-design-on-magento-2 (some mistake in article content).
You register fieldHandlers for customize field data. In current version We can't add custom fields and register field handlers without module modification. If You add event in Index controllers to extend that or change visibility to public for using DI plugins - It`ll be easier and re-usable for implementation
when use command php bin/magento setup:di:compile
Fatal error: Class 'Magento\CatalogSearch\Block\Result' not found in /home/magento2/public_html/app/code/Clerk/Clerk/Block/Result.php on line 8
Hi. If attribute code in magento has different name than "brand" then in Clerk brand attribute is empty for all products.
For example if brand attribute has code "manufacturer" in magento then in Clerk the brand attribute is empty and you need to add "manufacturer" as additional attribute sent to Clerk.
It should be a function in magento admin or in Clerk admin to map the sent attributes with Clerk attributes
In Clerk\Clerk\Controller\AbstractAction
there are 2 methods used to get public and private key for the API: getPrivateKey()
and getPublicKey()
These methods fetch the API keys from the config value as follows:
return $this->scopeConfig->getValue(
Config::XML_PATH_PUBLIC_KEY,
ScopeInterface::SCOPE_STORE
);
In case of multi-store data, the config fetches the API keys only from the default storeview, resulting in a 403 Invalid keys supplied
error when syncing the data.
As a solution, we can use the __store
parameter to pass the store code to these methods and fetch the private and public keys for their respected store view.
A solution would look something like below:
Fetching the store code in verifyKeys
method
private function verifyKeys(RequestInterface $request)
{
try {
$storeCode = $request->getParam("__store");
$privateKey = $request->getParam('private_key');
$publicKey = $request->getParam('key');
if ($privateKey !== $this->getPrivateKey($storeCode) || $publicKey !== $this->getPublicKey($storeCode)) {
return false;
}
return true;
} catch (\Exception $e) {
$this->clerk_logger->error('verifyKeys ERROR', ['error' => $e->getMessage()]);
}
}
And then the methods:
private function getPrivateKey($storeCode)
{
try {
return $this->scopeConfig->getValue(
Config::XML_PATH_PRIVATE_KEY,
ScopeInterface::SCOPE_STORE,
$storeCode
); //passing store code as extra parameter here
} catch (\Exception $e) {
$this->clerk_logger->error('getPrivateKey ERROR', ['error' => $e->getMessage()]);
}
}
HI,
Just installed your extension in Magento 2.2.6 and filled in the public and private key. After the save the Clerk configuration area stays white and returns the following error:
main.CRITICAL: Warning: Illegal string offset 'label' in /public_html/vendor/clerk/magento2/view/adminhtml/templates/facettitles.phtml on line 24 [] []
Hi,
I've noticed that you're directly calling the Object Manager. Magento says that developers should not use the object manager directly to load classes, instead inject the object in the constructors.
See
app/code/Clerk/Clerk/Model/Adapter/Product.php
app/code/Clerk/Clerk/Model/Config/Source/Language.php
app/code/Clerk/Clerk/Controller/Logger/ClerkLogger.php
app/code/Clerk/Clerk/Controller/Product/Index.php
app/code/Clerk/Clerk/Controller/AbstractAction.php
app/code/Clerk/Clerk/Controller/Version/Index.php
Can you look at this and resolve it?
Magento 2.3.3
module name="Clerk_Clerk" setup_version="3.3.2"
System -> Configuration -> Clerk -> Configuration
this page is blank
Hello.
I have problem with this extension v2.2.* after deploying on my local or to remote environments. Frontend is broken with exception:
1 exception(s):
Exception #0 (InvalidArgumentException): Unable to serialize value.
Exception #0 (InvalidArgumentException): Unable to serialize value.
#0 /var/www/pinoshop.loc/public_html/vendor/magento/framework/App/PageCache/Kernel.php(153): Magento\Framework\Serialize\Serializer\Json->serialize(Array)
#1 /var/www/pinoshop.loc/public_html/vendor/magento/module-page-cache/Model/Controller/Result/BuiltinPlugin.php(96): Magento\Framework\App\PageCache\Kernel->process(Object(Magento\Framework\App\Response\Http\Interceptor))
#2 /var/www/pinoshop.loc/public_html/vendor/magento/framework/Interception/Interceptor.php(146): Magento\PageCache\Model\Controller\Result\BuiltinPlugin->afterRenderResult(Object(Magento\Framework\View\Result\Page\Interceptor), Object(Magento\Framework\View\Result\Page\Interceptor), Object(Magento\Framework\App\Response\Http\Interceptor))
#3 /var/www/pinoshop.loc/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
#4 /var/www/pinoshop.loc/public_html/generated/code/Magento/Framework/View/Result/Page/Interceptor.php(26): Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', Array, Array)
#5 /var/www/pinoshop.loc/public_html/vendor/magento/framework/App/Http.php(139): Magento\Framework\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#6 /var/www/pinoshop.loc/public_html/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http->launch()
#7 /var/www/pinoshop.loc/public_html/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#8 {main}
This exception is result that in admin section not added public and private keys
I expect to see on Clerk.io only the orders of the right store scope: 1000001, 1000002 and 1000003 should have been imported only to My Store it_it, and 2000001, 2000002 and 2000003 should have been imported only to My Store eu_en.
All orders have been exported to both Clerk stores: My Store it_it has six orders (1000001, 1000002 and 1000003, 2000001, 2000002 and 2000003), and the same happens for My Store eu_en
Hi. It seems that for simple products you don't get magento price and special price the right way.
You have in Clerk price and initial price. For us these fields in Clerk are the same amount even in discount products. It should be initial price or price different amounts. You only get if a product is on sale which is right. With your function we can't use discount price and price to inform the customer in banners. Check screenshot(This is a product with discount). We tried also to send in Clerk magento special_price attribute and we found that again is the same price as price or initial price. We use magento 2.4.2.
Thank you in advance!
Hi!
This is using version 3.3.1 of this module on Magento OS 2.3.3
We are getting the following error when going to a search result page, for example: /catalogsearch/result/?q=test
:
Exception #0 (Exception): Warning: array_combine(): Both parameters should have an equal number of elements in vendor/clerk/magento2/Block/Result.php on line 72
<pre>#1 array_combine() called at [vendor/clerk/magento2/Block/Result.php:72]
#2 Clerk\Clerk\Block\Result->getSpanAttributes() called at [generated/code/Clerk/Clerk/Block/Result/Interceptor.php:50]
#3 Clerk\Clerk\Block\Result\Interceptor->getSpanAttributes() called at [vendor/clerk/magento2/view/frontend/templates/result.phtml:4]
#4 include() called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
#5 Magento\Framework\View\TemplateEngine\Php->render() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#6 Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
...
If I output the $titles
variable, I get:
Array
(
[1] => Array
(
[sort_order] => 0
)
[0] => Array
(
[label] =>
)
)
Calling array_keys
on that variable results in 2 elements:
Array
(
[0] => 1
[1] => 0
)
Calling array_column($titles, 'label')
on that variable results in 1 element:
Array
(
[0] =>
)
So it feels like this code isn't robust enough.
Is this enough info for you guys to figure this out?
Thanks!
Magento version : 2.4.3-p1
Clerk version : 4.6.0 (Upgraded from 4.5.0)
It seems like one of the later version breaks compilations in Magento.
www-data@4a2de3c9b0a4:~/public_html$ php bin/magento setup:di:compile
Compilation was started.
Interception cache generation... 6/9 [==================>---------] 66% 31 secs 476.0 MiBErrors during compilation:
Clerk\Clerk\Model\Adapter\Product
Extra parameters passed to parent construct: $StockStateInterface, $ProductMetadataInterface. File: /var/www/public_html/vendor/clerk/magento2/Model/Adapter/Product.php
Total Errors Count: 1
In Log.php line 92:
Error during compilation
setup:di:compile
Let me know if you have problems reproducing it
While removing a product in the backend, I encounter this issue:
Exception #0 (Exception): Warning: join(): Invalid arguments passed in .../public_html/vendor/clerk/magento2/Model/Api.php on line 67
In Model/Api.php the function removeProduct() is written as if it expects an array, while it is only called once in the extension, with a scalar product id. Please change
/**
* Remove product
*
* @param $productIds
*/
public function removeProduct($productIds)
{
$params = [
'key' => $this->_scopeConfig->getValue(Config::XML_PATH_PUBLIC_KEY),
'private_key' => $this->_scopeConfig->getValue(Config::XML_PATH_PRIVATE_KEY),
'products' => join(',', $productIds),
];
$this->get('remove', $params);
}
to
/**
* Remove product
*
* @param int $productId
*/
public function removeProduct($productId)
{
$params = [
'key' => $this->_scopeConfig->getValue(Config::XML_PATH_PUBLIC_KEY),
'private_key' => $this->_scopeConfig->getValue(Config::XML_PATH_PRIVATE_KEY),
'products' => $productId,
];
$this->get('remove', $params);
}
On product data sync Dropdown attributes(color, manufacturer) are synced as number and contain option_id instead option text value per store view: http://prntscr.com/h1ampx
For empty values they synced as object: http://prntscr.com/h1an6b
For M1 version You get data more safe and use helper for that : https://github.com/clerkio/clerk-magento/blob/master/code/Helper/Data.php#L21
Reproduced on Magento 2.1.x - 2.2.x.
I am not quite sure why this controller exists as it does, it is filled with deprecated methods and is loading each product twice, once from the collection, and once with ObjectManager just to get the CreatedAt attribute ?
https://github.com/clerkio/clerk-magento2/blob/master/Controller/Product/Index.php
Anyways, the results from this controller formats the price attribute as a string, which in turn causes the value if above 1000 to be formatted as 1 if price is between 1.000 and 1.999 and 2 if it is between 2.000 and 2.999 and so on
a temporary patch can be applied to overcome this issue where we force the product price to be returned as a float
Force float values since clerk requires float but formats them as strings
@package clerk/magento2
--- Controller/Product/Index.php
+++ Controller/Product/Index.php
@@ -122,6 +122,9 @@
$response[$key]['list_price'] = number_format((float) floatval($price) ? (float) floatval($price) : 0, 2);
}
+ $response[$key]['price'] = floatval($product->getPrice());
+ $response[$key]['list_price'] = floatval($product->getPrice());
+
$response[$key]['stock'] = $stockItem->getQty();
$response[$key]['product_type'] = $productType;
$response[$key]['created_at'] = strtotime($product->getCreatedAt());
Hi. It seems that in your latest version you have missed in line 251:
$price = $item->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue());
you have a wrong
)
at the end.
Right syntax is:
$price = $item->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue();
Issue is caused by
https://github.com/clerkio/clerk-magento2/blob/master/Model/Adapter/AbstractAdapter.php#L170
PHP Warning: Array to string conversion in /home/cloudpanel/htdocs/www.example.com/releases/2022_09_07_4_25_31_branch_v2.4.4-3/vendor/clerkio/magento2/Model/Adapter/AbstractAdapter.php on line 170
I looked at the format of data and it looked like this
Array
(
[0] => Array
(
[0] => Ethinylestradiol
[1] => Progestogen
)
[1] => Array
(
[0] => Ethinylestradiol
[1] => Progestogen
)
[2] => Array
(
[0] => Ethinylestradiol
[1] => Progestogen
)
)
So it's throwing an error synching multiselect attributes which return their value as an array. You're going to need to use an array filter to implement uniqueness or implode and then explode the data.
Description
When I go into the stores -> configuration settings I do not see a tab anymore for Clerk.
System environment
Looks as some issue:
https://github.com/clerkio/clerk-magento2/blob/master/Controller/Checkout/Cart/Add.php#L53
It triggers adding product with id =12 in store.
Please fix issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.