Opencart event for checkout success - opencart

How to handle custom after purchase action in opencart, without modifying core code?
Event 'post.order.add' is called before payment and I can't find anything for after the payment had been completed :( the most important action missing

I can think of two ways:
1) You could use event post.order.history and then check number of history rows to determine whether to apply action or not. If there is only one that would indicate the order has only just been confirmed. Something like this:
$this->load->model('account/order');
if (count($this->model_account_order->getOrderHistories($order_id)) <= 1) {
// do stuff
}
There are probably other flags you could use to decide whether or not to trigger the action - the point being that you just need a condition you can depend on since this action is triggered on payment confirmation and every other order history update thereafter.
2) Use vQmod and apply something to the success.php controller. Install vQmod and construct an xml file like this:
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id>Order Success Event</id>
<version>1.0</version>
<vqmver>2.4</vqmver>
<author>johndoe#example.com</author>
<file name="catalog/controller/checkout/success.php">
<operation>
<search position="after"><![CDATA[public function index()]]></search>
<add><![CDATA[
// Things to do after order success event
]]></add>
</operation>
</file>
</modification>

Related

Opencart 3 Add Additional Delivery Detail

I need to add additional delivery option in the delivery detail of Opencart 3's checkout page.
I found the file in > catalog/view/theme/default/template/checkout/shipping_address.twig
I tried modify but not visual change in the checkout page.
Can anyone guide me to the correct file ?
Note: currently im using default template.
Create a file, named "install.xml" and then zip it. Then install it as module from extension upload. And then refresh cache from "Modifications".
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Additional Delivery Detail</name>
<code>delivery</code>
<version>1.0</version>
<author>white coffeee</author>
<link></link>
<file path="catalog/view/theme/default/template/checkout/shipping_address.twig">
<operation>
<search><![CDATA[ **CODE TO BE SEARCHED** ]></search>
<add position="after"><![CDATA[
**CODE TO BE ADDED**
]]></add>
</operation>
</file>
</modification>

how to display future products in opencart

products in open cart script doesn't show up in front end page when i add product and set the date to the future
am trying to display future products S i want to know how can i do that is there anyway i can do that,i do search a lot for answer to that question but all i found is xml file need vqmod system but it's not working too . so please guys am trying to display future products on homepage
here's then answer which didn't work
<modification>
<id><![CDATA[Products with future available date become able to show in store and be purchased]]></id>
<version><![CDATA[1.0.0]]></version>
<vqmver><![CDATA[2.0.0]]></vqmver>
<author><![CDATA[angeloop]]></author>
<file name="catalog/model/catalog/product.php">
<operation>
<search position="after"><![CDATA['p.date_added']]></search>
<add><![CDATA[, 'p.date_available']]></add>
</operation>
<operation>
<search position="replace"><![CDATA[AND p.date_available <= NOW()]]> </search>
<add><![CDATA[]]></add>
</operation>
</file>
<file name="system/library/cart.php">
<operation>
<search position="replace"><![CDATA[AND p.date_available <= NOW()]]></search>
<add><![CDATA[]]></add>
</operation>
</file>
</modification>
I have created a module for it.
Go to the link below
Coming soon products module for OpenCart
Download the modules and set the modules which will show future products or coming soon products

Proper way to work using the real image of a product on OpenCart 2

I'm currently looking for the proper way to work on a theme using the real image of a product and not its thumbnail (identified as $thumb in the default theme).
I have found a abrupt trick by adding a line in the controller file:
$this->data['cover'] = $product_info['image'];
But does anybody have experienced a better method (eg with vqmod) to retrieve these real image data without changing controller content (for using in template pages, such as product.tpl or category.tpl for example)?
With help from members of OpenCart forum, I managed to find a functional solution (using vQmod).
It is thus require to create an .xml file placed in the vqmod/xml folder and containing, for example:
<?xml version="1.0" encoding="utf-8"?>
<modification>
<id>Recover Real Image</id>
<version></version>
<vqmver></vqmver>
<author></author>
<email></email>
<website></website>
<file name="catalog/controller/product/product.php">
<operation>
<search position="after"><![CDATA[
$data['points'] = $product_info['points'];
]]></search>
<add><![CDATA[
$data['picture'] = HTTP_SERVER.'/image/'.$product_info['image'];
]]></add>
</operation>
</file>
</modification>
If product image can not be found and assuming a <default.jpg> is put the root of the <image> folder, the <add> element can be replaced by:
if(empty($product_info['image'])){
$data['picture'] = HTTP_SERVER.'image/default.jpg';
}
else{
$data['picture'] = HTTP_SERVER.'image/'.$product_info['image'];
}
Other possible suggestions, by using:
OCmod can be found here
Image Autosize extension can be found here

Correct implementation of Google Tag Manager in OpenCart

I need some advice in placing Google Tag Manager (assuming the API is already written) in OpenCart. I've thought of loading it straight from header.tpl, however I want to know what the cleanest implementation would be.
I've found this solution to be optimal for me. Tested and it works. You will need Vqmods installed (https://github.com/vqmod/vqmod/wiki).
I used an edited version of this script (http://www.opencart.com/index.php?route=extension/extension/info&extension_id=18200). Basically, what you want to do is replace the search query so that it matches your body tag's class.
Keep in mind that you should check your header.tpl to make sure you place the GTM code right at the beginning of your body tag.
Finally, my edited xml:
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id><![CDATA[Google Tag Manager]]></id>
<version><![CDATA[1.0]]></version>
<vqmver><![CDATA[]]></vqmver>
<author><![CDATA[hany.mesbah#gadalla.com]]></author>
<file name="catalog/view/theme/*/template/common/header.tpl">
<operation error="log">
<search position="after"><![CDATA[<body class="fs<?php echo $themeConfig['fontsize'];?> <?php echo $helper->getPageClass();?> <?php echo $helper->getParam('body_pattern','');?>">]]></search>
<add><![CDATA[your GTM code snippet]]></add>
</operation>
</file>
</modification>

Is it possible to search SharePoint metadata?

When I use the Search.asmx web service it won't allow me to search MetaData. Is there a way that I can do this?
Below is what I have come up with so far for my query, but it errors out with an InvalidPropertyException every time I run it.
<?xml version="1.0" encoding="utf-8" ?>
<QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1000">
<Query domain="QDomain">
<SupportedFormats><Format>urn:Microsoft.Search.Response.Document.Document</Format></SupportedFormats>
<Context>
<QueryText language="en-US" type="MSSQLFT">
<![CDATA[ SELECT Title, Rank, Size, Description, Write, Path FROM portal..scope() WHERE "Published" = 'Yes' ORDER BY "Rank" DESC ]]>
</QueryText>
</Context>
<Range><StartAt>1</StartAt><Count>20</Count></Range>
<EnableStemming>false</EnableStemming>
<TrimDuplicates>true</TrimDuplicates>
<IgnoreAllNoiseQuery>true</IgnoreAllNoiseQuery>
<ImplicitAndBehavior>true</ImplicitAndBehavior>
<IncludeRelevanceResults>true</IncludeRelevanceResults>
<IncludeSpecialTermResults>true</IncludeSpecialTermResults>
<IncludeHighConfidenceResults>true</IncludeHighConfidenceResults>
</Query></QueryPacket>
You can't just search an arbitrary column of metadata, you need to make sure it gets crawled first and is made available under a sensible name (managed property). See this blog post for an example.
Also, if Published is a boolean, I think you might want to test "Published" = 1, in stead of yes.