clerkio / clerk-magento Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Write new feedgenerator with focus on low memory usage.
Prisen vises forkert på powersteppet, hvis man tilføjer et konfigurerbart produkt (underprodukt) til indkøbskurven.
Det er prisen fra hovedproduktet, og dermed ikke den korrekte pris der vises.
Antallet er også forkert. Kunden forventer at der står "2 produkter er tilføjet kurven" hvis man tilføjer 2 stk. af et produkt.
Men den tæller produktlinier i kurven, og ikke mængden af produkter.
Tilføjer man 2 stk. af varen, står der stadig kun 1 produkter.
Nyeste clerk version og Magento 1.9.3.1 med patches
The template names generated in the extension, do not match the standard auto-generated ones from my.clerk.io's Setup Guide.
These translations should be made:
search
-> search-page
livesearch
-> live-search
powerstep
-> power-step-others-also-bought
The file generating the template-names is:
app/design/frontend/base/default/layout/config.xml
https://github.com/clerkio/clerk-magento/blob/master/code/etc/config.xml#L151
This means every minute at 4 am: * 4 * * *
I don't think that's what supposed to happen?
We use Clerk v2 on our dev site, on Magento 1.9.4.2 with Onestepcheckout.
When people on IOS/Safari (Macbook, Iphone etc) wants to checkout, it wont work. The button ' place order' on onestepcheckout is not responding. The button just wont work.
When moving back to v1, everything works fine.
It has to do something with the javascript.
When using 3rd party softwares like ManaDev, which inserts filters on the search page, a lookup to Magentos internal SQL database is still made even after activating the module.
This causes Magento to return an error page when a misspell is made, and the word cant be found in the database.
A possible fix is this:
Find the file
app/code/core/Mage/CatalogSearch/Model/Fulltext.php
Insert the IF-Statement if ($query->getId() != '') {}
around the following line $this->getResource()->prepareResult($this, $queryText, $query);
It should look like this:
if ($query->getId() != '') {
$this->getResource()->prepareResult($this, $queryText, $query);
}
This will cause Magento to ignore if the SQL lookup returns false, so it doesnt give back an error.
The approach should be to make an observer for the clean_media_cache_after
event, that will start a the default feedbuilder.
The sales data synced with the feed is only needed once.
But right now it is build with the feed at every single feed generation. This is a waste of recources and we have to find a better solution
Magentos currency conversion can be integrated as a TemplateFormatter, which makes it easy to use multi-currency with Clerk.io.
It can be integrated in this file:
app->design->frontend->base->default->template->clerk->tracking.phtml
The following code has been supplied by a developer I talked to, and it worked on another shop as well. It comprises the entire tracking.phtml file:
<?php
$publicapikey = Mage::helper('clerk')->getSetting('clerk/general/publicapikey');
$formkey = Mage::getSingleton('core/session')->getFormKey();
// Convert price to current currency
$baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
$currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
$currentCurrencySymbol = Mage::app()->getLocale()->currency($currentCurrencyCode)->getSymbol();
$rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, $currentCurrencyCode);
?>
<script type="text/javascript">
window.clerkAsyncInit = function() {
Clerk.config({
key: '<?php echo $publicapikey; ?>',
templateFormatters: {
form_key: function () {
return '<?php echo $formkey; ?>';
},
// CUSTOM !! > In the Clerk design you can now use {{ price_in_currency }}
// This converts the price from EUR to the requested currency
price_in_currency: function(price) {
price = Math.round(price * 100) / 100;
var price_converted = Math.round((price * <?php echo (float)$rates[$currentCurrencyCode] ?>) * 100) / 100;
var retVal = <?php echo json_encode($currentCurrencySymbol) ?> + ' ' + price_converted.toFixed(2).toString();
return retVal;
}
}
});
};
(function(){
var e = document.createElement('script'); e.type='text/javascript'; e.async = true;
e.src = document.location.protocol + '//api.clerk.io/static/clerk.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(e, s);
})();
</script>
Powerstep sometimes has some CSS issues that causes it to look wrong on mobile devices.
The below is an example fix that causes it to align better to different screen sizes.
Insert the following in skins/clerk/style.css
.checkout-cart-clerk .col4, .checkout-cart-clerk .col6, .checkout-cart-clerk .col8, .checkout-cart-clerk .col12 {
box-sizing: border-box;
}
Add param setting : which of the 3 images to sync
'image';
'thumbnail';
'small_image';
Module is dropping a lot of exceptions/notices/warnings in system.log for unhandled stuff:
Notice: Undefined index: DKK in /app/design/frontend/base/default/template/clerk/tracking.phtml on line 20
Notice: Undefined property: stdClass::$message in /app/code/community/Clerk/Clerk/controllers/Adminhtml/Clerk/WidgetController.php on line 20
Notice: Undefined property: stdClass::$contents in /app/code/community/Clerk/Clerk/Helper/Data.php on line 67
Warning: Invalid argument supplied for foreach() in /app/code/community/Clerk/Clerk/Helper/Data.php on line 67
Warning: array_intersect(): Argument #2 is not an array in /app/code/community/Clerk/Clerk/controllers/Adminhtml/Clerk/WidgetController.php on line 68
Add observer to remove returned/creditmemo products from orders
Clerk is a great relational data linker... but when the incoming data is incorrect and returned items are not removed from the order data .... the results can be
Currently returns and changed items are not removed from the sales product sync to Clerk. Our service dept sometimes updates orders adds/removes products before shipping and also customers return products (often 18-22%) ...... so we could have 22% statistical data that should not be there. And more important: the system is neglecting human feedback: people do not want the product.
I hope you see the statistical importance. Recommendations based on for instance 22% insignificant data would not seem very logical. Also imagine the following case: of all 5 occurences of product A and B being ordered in 1 sale, 100% of product B is returned. Maybe we should then not-suggest it.
Maybe an observer can be installed to monitor order changes and credit memos and update Clerk.
The process would then be
I hope this helps
Since the release of extension v2.0.6, the version has been written as 2.0.5 in the Magento backend when viewing the extension.
Version number can be changed in the top of this file:
app/code/community/Clerk/Clerk/etc/config.xml
The new version 3.5.1 is not on packagist.org (https://packagist.org/packages/clerk/magento)
Fjellsport had an issue where installing the module, caused their existing add-to-cart popup to break.
It happens because we overwrite the Mage_Checkout
controller, with a "before" event.
It can be easily fixed by changing to "after" in config.xml.
From Emil at TrollWeb:
We have changed this in the file app/code/community/Clerk/Clerk/etc/config.xml, and yes, it should have to do with the powerstep functionality.
[...] It would be preferable if you could actually change this in coming versions of the official module? Since the Clerk CheckoutController only adds functionality as far as we know (extra controller action), and doesn't override anything, it's not really necessary to run it before Mage_Checkout. That is unless you plan to override any Magento core functions later on.
<?xml version="1.0" encoding="UTF-8"?>
<config>
<!-- ... -->
<frontend>
<!-- ... -->
<routers>
<!-- ... -->
<checkout>
<use>standard</use>
<args>
<modules>
**<!-- Changed from before to after -->
<Clerk_Clerk _after_="Mage_Checkout">Clerk_Clerk_Checkout</Clerk_Clerk>
</modules>**
</args>
</checkout>
</routers>
</frontend>
<!-- ... -->
</config>
Hi,
I am getting this error after installing clerk (3.3.0) module on my magento(1.7.0).
Error is showing given below.
Error parsing body - doesn't seem to be a chunked message
Trace:
#0 /var/www/html/lib/Zend/Http/Response.php(262): Zend_Http_Response::decodeChunkedBody('??????????E?=??...')
#1 /var/www/html/app/code/community/Clerk/Clerk/Model/System/Config/Source/FacetAttributes.php(37): Zend_Http_Response->getBody()
#2 /var/www/html/app/code/community/Clerk/Clerk/Model/System/Config/Source/FacetAttributes.php(12): Clerk_Clerk_Model_System_Config_Source_FacetAttributes->getFacetAttributes()
#3 /var/www/html/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php(463): Clerk_Clerk_Model_System_Config_Source_FacetAttributes->toOptionArray(true)
#4 /var/www/html/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php(229): Mage_Adminhtml_Block_System_Config_Form->initFields(Object(Varien_Data_Form_Element_Fieldset), Object(Mage_Core_Model_Config_Element), Object(Mage_Core_Model_Config_Element))
#5 /var/www/html/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php(164): Mage_Adminhtml_Block_System_Config_Form->_initGroup(Object(Varien_Data_Form), Object(Mage_Core_Model_Config_Element), Object(Mage_Core_Model_Config_Element))
#6 /var/www/html/app/code/core/Mage/Adminhtml/Block/System/Config/Edit.php(92): Mage_Adminhtml_Block_System_Config_Form->initForm()
#7 /var/www/html/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php(107): Mage_Adminhtml_Block_System_Config_Edit->initForm()
#8 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Adminhtml_System_ConfigController->editAction()
#9 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('edit')
#10 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#11 /var/www/html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#12 /var/www/html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#13 /var/www/html/index.php(91): Mage::run('', 'store')
#14 {main}
#14 {main}
Please check this and let me know that how can we fixed this issue.
Thanks,
Brijesh
If the image cache is cleared all products should be synced with clerk.io. This is best done through a full sync.
It can be done by calling the following URL:
https://api.clerk.io/v2/client/account/importer/start?key=API_KEY&private_key=PRIVATE_API_KEY
This will trigger clerk.io to run a full sync.
When applying discount codes to orders, sales tracking report the actual price of product and not the discounted price. :)
Some customers seems to experience that add and remove actions are not synced to clerk.io correctly through the product changed api.
Hello,
in a multistore Magento installation we have this problem while sync a second store view
[2019-02-22 18:09:18] [WARNING] Import stopped: Got a unexpected response from the Magento API: "
With the first store view we didn't have any error, with this secondo one we have this errorI don't have any error log on our web server
Magento module uses generic Python User Agent name. Some developers want to block out unnecessary traffic, but its hard to give the module access, without a more defined name.
The following call is being sent by the module:
52.28.255.187 - - [10/Oct/2016:11:14:47 +0200] "GET /clerk/api/product/?limit=200&page=1&store=4 HTTP/1.1" 401 188 "-" "python-requests/2.7.0 CPython/2.7.10 Linux/4.1.13-19.31.amzn1.x86_64"
Module should use a more clearly defined User Agent Name, like clerk_bot, allowing developers to easily allow access for our module only.
Example:
52.28.255.187 - - [10/Oct/2016:11:14:47 +0200] "GET /clerk/api/product/?limit=200&page=1&store=4 HTTP/1.1" 401 188 "-" "clerk_bot"
I dont think we need Clerk in our backend templates
Please only show it on the frontend
0.0004 clerk_livesearch_script (not cached)
Mage_Core_Block_Template
app/design/frontend/base/default/template/clerk/livesearch.phtml
0.0025 clerk_tracking_script (not cached)
Clerk_Clerk_Block_Tracking
app/design/frontend/base/default/template/clerk/tracking.phtml
0.0004 clerk_powerstep (not cached)
Clerk_Clerk_Block_Powerstep
app/design/frontend/base/default/template/clerk/powerpopup.phtml
0.0004 clerk_exit_intent_script (not cached)
Clerk_Clerk_Block_ExitIntent
app/design/frontend/base/default/template/clerk/exitintent.phtml
Direct link to cached image?
For discussion
We see Clerk links directly to a cached image (I would call it temporary)
but if you clean the magento cache then this link expires and a new one is made (but clerk does not know)
Would it be smarter to link to the uncached URL and direct link of this iamge?
plz download tgz package
https://github.com/clerkio/clerk-magento/releases/tag/3.5.4
layout xml is there
template files are missing
hence does not work
Still say 2.1.13 in config.xml
The default real-time add/remove sync behavior is singular while the API default is bulk.
This creates overhead for bulk updates.
Fix: Make the default behavior bulk and treat single changes as a bulk operation on a set of one products.
Hi guys,
please can you add your repository to packagist.org like magento2 extension?
I know composer for magento1 is less used but for me is very helpful.
Thank you for your support!
getAttributeSafe : does this not slow the whole procedure down?
Why not use getManufacturer? or use a dummy function with a param for the correct Manufacturer attribute key?
clerk-magento/code/Helper/Data.php
Line 12 in 8dfe068
Please add category Title Chooser in config
Some websites use two attributs for categories
The TITLE can be quite short something like "White"; suppose in a menu like "Shirts->White"; however the page title on the page is "White Shirts" taken from another attribute
Default should stay default 'name' but one should be able to change it in the backend
Quick and SImple win ; also goes for M2
We need a framework for testing and some very basic tests for a start, also a ci integration would be nice.
http://www.gorillagroup.com/trending/insight/validating-magento-extensions-phpunit/
May be a starting point
Hi, i'm having this issue:
2017-10-24T22:46:54+00:00 ERR (3): Notice: Undefined index: BRL in /app/design/frontend/base/default/template/clerk/tracking.phtml on line 20
Can you Help me?
@RBech every time you release a new version it's not published on packagist.org automatically.
There's a packagist feature called "Auto Update" (https://packagist.org/about#how-to-update-packages). IMHO you should activate it.
When customers are using custom links that differ from Magentos BaseURL, the Import URL will be wrong.
If a webshops actual link is
http://www.mywebsite.com/it
for example, the import URL will only be written as:
http://www.mywebsite.com/clerk/api/store/1
missing the /it part
Maybe the URL needs to be extended in the file that generates it:
app/code/community/Clerk/Clerk/Block/Adminhtml/Url.php
Potential fix from customer who had the issue:
From the frontend you could use the following code snippet to get the complete url:
$store= Mage::app()->getStore();
$url= $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK).'clerk/api/store/'.$store->getId();
This code works with “add store code to urls” option; if this option is set to “yes” then I get the following urls on my Magento:
https://www.diegodallapalma.com/it/clerk/api/store/1 (for italian store-view)
https://www.diegodallapalma.com/en/clerk/api/store/2 (for english store-view)
If “add store code to urls” option is set to “no” then I get the following urls:
https://www.diegodallapalma.com/clerk/api/store/1 (for italian store-view)
https://www.diegodallapalma.com/clerk/api/store/2 (for english store-view)
From the backend you could use this snippet instead:
$store_code= Mage::app()->getRequest()->getParam('store');
if (!empty($store_code))
{
$store = Mage::app()->getStore($store_code);
$url = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . 'clerk/api/store/' . $store->getId();
}
$store_code is empty if I select “default config” from the scope select-menu; but if I select a store-view then I get a non-empty code and I can also get a complete url. It works with “add store code to urls” option and I get the same urls of the frontend code snippet.
We should program a new and improved feed generator that builds the feed in a uniform way, regarding of where the the process is called.
Right now, the feature to show searches in the Magentos backend, as well as category redirects on specific searches, are disabled when the module is activated.
A possible fix is the following:
Open the file
app -> code -> community -> Clerk -> Clerk -> controllers -> CatalogSearch ->ResultController.php
Find the following lines of code:
if (!Mage::helper('clerk')->getSetting('clerk/search/active')) { return parent::indexAction();
Insert the following code below it:
$query = Mage::helper('catalogsearch')->getQuery();
$query->setStoreId(Mage::app()->getStore()->getId());
if ($query->getQueryText() != '') {
if (Mage::helper('catalogsearch')->isMinQueryLength()) {
$query->setId(0)
->setIsActive(1)
->setIsProcessed(1);
} else {
if ($query->getId()) {
$query->setPopularity($query->getPopularity() + 1);
} else {
$query->setPopularity(1);
}
if ($query->getRedirect()) {
$query->save();
$this->getResponse()->setRedirect($query->getRedirect());
return;
} else {
$query->prepare();
}
}
Mage::helper('catalogsearch')->checkNotes();
if (!Mage::helper('catalogsearch')->isMinQueryLength()) {
$query->save();
}
}
This will enable us to start feedgeneration based on events.
The inital approach will be to use a flag in the config that inducates if a feed should be build.
The feedgeneration will start based on this flag, and cronjob will run every 5 minutes and check if the flag is set, while the feed is building other feed building processes should not be started.
An optimal solution would be to run the the process as a background thread if possible
At some point we worked on currency convertion, we should finish this code. The status of this task is a but messy.
When Price Rules are used in Magento, the module calculates them wrongly, and ends up subtracting the price-rule twice.
Cannot reproduce in our magento.clerk.io setup, but it happens for many customers.
A possible fix is the following:
Open the file
app -> code -> community -> Clerk -> Clerk -> Model -> Catalog -> productbase.php
Find the following code starting at line 72:
$price = $this->getPrice();
if ($includeDiscounts) {
$price = Mage::getModel('catalogrule/rule')
->calcProductPriceRule($this, $this->getFinalPrice());
if (!isset($price)) {
$price = $this->getFinalPrice();
}
}
Replace it with the following code:
$price = $this->getPrice();
if ($includeDiscounts) {
$price = Mage::getModel('catalogrule/rule')
->calcProductPriceRule($this, $this->getPrice());
if ($price != $this->getFinalPrice()) {$price = $this->getFinalPrice();}
if (!isset($price)) {
$price = $this->getFinalPrice();
}
}
This effectively check if its the right FinalPrice we are using and if not, will set it accordingly.
The module uses the wrong product image on Powerpage.
It fetches the main product image and resizes this to a small resolution, instead of fetching the small product image (or thumbnail).
The primary problem with this is experienced when you use the watermark function in Magento. This means that the watermark logo will be way too big and cover the whole product image.
Other than that it will add an unnecessary size of the image and thereby adding load time/file size.
See:
https://github.com/clerkio/clerk-magento/blob/master/design/template/powerpage.phtml#L13
should be 'small_image' instead of image fx.
Some customers have modules that manipulate Order ID's, turning them intro strings like:
2017/06/05-123.
In these cases, the module always track the Orders as 0, since we Int-Cast all order id's in Orderpage.php, on line 51
:
$data['id'] = (int) $order->getIncrementId();
A possible fix could be to first check if the Order ID is actually a number, and if not, make sure to not Int-Cast it.
On the Clerk's system configuration page, in the Magento backend, If the system config clerk/faceted_search/attributes
is empty you'll get the following error:
Warning: Illegal string offset 'label' in ../Block/Adminhtml/System/Config/Form/AttributeLabels.php on line 25
The current getDiscountPercent
function wrongly calculates the discount to a negative number.
In Productbase.php, replace the getDiscountPercent
function with this instead, and it works:
public function getDiscountPercent()
{
if($this->isOnSale()) {
return round( (($this->getClerkRetailPrice()-$this->getClerkFinalPrice() ) / $this->getClerkRetailPrice())*100 );
}
else {
return 0;
}
}
Usecase:
Magento 1.9.4.2.
Clerk v2
The powerstep is not an page anymore (works with v1 of clerk), but its now an popup which is off-centered.
Any specific you are using Varien_Http_Client rather than Zend_Http_Client:
clerk-magento/code/Model/Communicator.php
Line 184 in 07f3928
Varien_Http_Client does not take into account that cURL decodes chunked messages, so when Varien_Http_Client decodes it, it messes up the transmission's chunk sizes.
I found this issue while updating Clerk following this: https://help.clerk.io/using-clerk-io-on-magento-1/upgrading-extension/upgrading-the-clerkio-magento-1-extension-from-v1
When using Varien_Http_Client I get this error:
There has been an error processing your request
Error parsing body - doesn't seem to be a chunked message
Trace:
#0 /var/www/magento/lib/Zend/Http/Response.php(262): Zend_Http_Response::decodeChunkedBody('\x1F\x8B\x08\x00\x00\x00\x00\x00\x00\x035\x8E\xB9\x0E\xC2...')
#1 /var/www/magento/app/code/community/Clerk/Clerk/Block/Adminhtml/System/Config/Form/FacetedSearchFieldset.php(56): Zend_Http_Response->getBody()
#2 /var/www/magento/app/code/community/Clerk/Clerk/Block/Adminhtml/System/Config/Form/FacetedSearchFieldset.php(17): Clerk_Clerk_Block_Adminhtml_System_Config_Form_FacetedSearchFieldset->keysValid()
#3 /var/www/magento/lib/Varien/Data/Form/Element/Abstract.php(223): Clerk_Clerk_Block_Adminhtml_System_Config_Form_FacetedSearchFieldset->render(Object(Varien_Data_Form_Element_Fieldset))
My solution is to use Zend_Http_Client rather than Varien_Http_Client. This fixes the issue.
This is tested in Magento 1.7.
Line 8 of app/design/frontend/base/default/template/clerk/tracking.phtml has an extra closing ?>
Customers who send us HTML and Javascript in their product attributes, cause the Importer to fail, since the script type="text/javascript"
part is not escaped.
Example data from importer:
<meta charset=\"utf-8\"><script type="text/javascript">window.NREUM||(NREUM={}),__nr_requ
Make sure that all HTML and scripts are escaped.
A streamwriter that enables us to stream out the feed. Thus we do not need to keep the feed in momery while building.
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.