Add affiliate tracker code to virtuemart thank you page - joomla

I want to add an affiliate tracker code to my Joomla based website using VirtueMart. They told me to add the code on the thank you page but I couldn't figure it out. The VirtueMart version is 2.0.12 and the code is
<script src="http://network.clickbanner.gr/i_sale_third/10566/SALE_AMOUNT/TRANSACTION_ID
/OPTIONAL_INFORMATION&sale_status=P"></script>
<noscript><img src="http://network.clickbanner.gr/i_track_sale/10566/SALE_AMOUNT/TRANSACTION_ID
/OPTIONAL_INFORMATION&sale_status=P"></noscript>
Ι have to replace SALE_AMOUNT with the order's price excluding tax and the transaction_id with the order id. Any ideas how to achieve this?

Solution:
The output of thank you page can be edited in /plugins/vmpayment/standard/standard.php (for standard payment method) or /plugins/vmpayment/paypal/paypal.php. Find the $html variable in plgVmConfirmedOrder($cart, $order) function and add the code you want after the line $html .= '</table>' . "\n"; (line 135). In my case the code is:
$html .= '<script src="http://network.clickbanner.gr/i_sale_third/10566/'.$order['details']['BT']->order_subtotal.'/'.$order['details']['BT']->order_number.'
/OPTIONAL_INFORMATION&sale_status=P"></script><noscript><img src="http://network.clickbanner.gr/i_track_sale/10566/'.$order['details']['BT']->order_subtotal.'/'.$order['details']['BT']->order_number.'/OPTIONAL_INFORMATION&sale_status=P"></noscript>';

You can achieve this like,
First the order confirmation page of VM2.x is order_done.php
the file you can find in the path : components/com_virtuemart/view/cart/tmpl/order_done.php
second thing.
The order placed in VM storing in the order table #__virtuemart_orders
with order id you can find all the amounts. with tax without tax etc.
(order_number,order_pass,order_total,order_subtotal,order_tax)

Related

display poll questions after buyer place an order in magento

after buyer completed transaction[or "place an order"], I want to provide an option
for "survey" or "poll" about the site .
So I can know about the buyer's satisfaction about our site.
let me know if you have need any clarifications.
Thanks a lot in advance.
You can add "survey" on success.phtml page.
Go to your theme /app/design/frontend/default/default/template/checkout > success.phtml Add your survey functionality on this page.
This pages displays after successful transaction.
if you have any question feel free to ask.
In success.phtml try following code to display poll.
<?php
$poll = $this->getLayout()->createBlock('poll/activePoll');
$poll->setPollId(2);
$poll->setPollTemplate('poll/active.phtml', 'poll');
$poll->setPollTemplate('poll/result.phtml', 'results');
echo $poll->toHtml();
?>
You can pass desired poll ID in setPollId method.
You can refer full description using following link.
http://inchoo.net/magento/magento-frontend/reusing-magento-poll-on-any-page-or-any-block/

How to filter product based on specific arrribute in magento and call via cms page as well from controller

I need some tips to use product list functionality in my cms pages.
like in my cms page named "manufacture = apple" should show all products of apple manufacture .
same for other attribute like color, size etc .....
Thanks.
You need to create small module. I can't share complete code here, but sharing you a helpful link which I have earlier used and working fine.
Link:https://www.atwix.com/magento/products-list-cms/
Hope it will helpful!
create a template (test.phtml) under yourtheme/catalog/product and add the following code to your test.phtml
<?php
$arrParams = array_slice($this->getRequest()->getParams(),1);
$attribute = each($arrParams);
$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter($attribute[0],$attribute[1]);
echo '<pre>';
print_r($collection->getData());
exit;
?>
than call this template to your cms page. Add the code below in content area of your cms page.
{{block type="catalog/product" template="catalog/product/test.phtml"}}
once you have the array of product than display it as per your requirement.

Magento modify admin order items view called by getColumnHtml method

In my Magento admin I want to modify the display of ordered items in an order.
I found that the table is in design/adminhtml/default/default/template/sales/order/view/items.phtml
and the data in design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml
I need to add some data in the first column : product.
I found that this following code build the HTML : (line 68 of default.phtml in Magento 1.4)
<?php echo $this->getColumnHtml($_item, 'name') ?>
I searched a lot to find where the html is build but I can't find.
Found it :
app/design/adminhtml/default/default/template/sales/items/column/name.phtml
Cheers.

Get magento subtotal from cart

I'm currently using this snippet to show the cart totals in the topcart of my Magento shop. My problem is that it's not always updating when products is put in cart, it's just showing 0$, especially configurable products. But when a second product is put in the cart, it's working again.
Am I missing something, should there be a "check" of some kind before this piece of code?
<?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?>
You can also try following code it works for me
<?php echo Mage::helper('checkout/cart')->getQuote()->getSubtotal() ?>
Make sure your top cart block is extending a relevant block type such as Mage_Checkout_Block_Cart_Sidebar. If you do, you will have access to useful functionality that will save you rewriting unnecessary code.
For example, if you extend Mage_Checkout_Block_Cart_Sidebar - you can call getSubtotal()
An alternative would be to use the following:
Mage::getSingleton('checkout/session')->getQuote()->getSubtotal();
you can use this code:
$subtotals= Mage::getSingleton('checkout/session')->getQuote()->getSubtotal();
echo $formattedPrice = Mage::helper('core')->currency($subtotals , true, false);
None of the above worked for me but I was able to get the subtotal using this:
$orderObj = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
$orderSubTotal = $orderObj->getSubtotal();
echo $orderSubTotal;
This refers to the success.phtml page.

Prestashop smarty code

I want to implement an affiliate platform on my prestashop website.
The tracking code look's like this:
http://event.2parale.ro/events/salecheck?
amount=__ADD_SALE_VALUE__&campaign_unique=1f32b97d0&confirm=b51214c259e91116&description=__ADD_DESCRIPTION__&transaction_id=__ADD_TRANSACTION_ID__
The problem is that I don't seem to properly replace __ADD_SALE_VALUE__, _ADD_DESCRIPTION__ and __ADD_TRANSACTION_ID__ with the proper code for the total value of the order, the products sold and the order's id.
Please help.
Regards,
Sorin
You are using Smarty, right? If so this should do:
In PHP
<?php
$smarty->assign('sale_value', 1000);
// ...
$smarty->assign('transaction_id', 123456);
Smarty template:
amount={$sale_value}&campaign_unique=1f...&transaction_id={$transaction_id}

Resources