Add google trusted stores badge - php

I have followed the steps in here
Add Google trust badge to Magento
And then in here:
http://www.magentocommerce.com/magento-connect/google-trusted-stores.html
In all pages the first javascript part shows fine.
In the checkout success page, it doesnt show fine the code. (see update below)
I know I am editing the correct file because I typed static text into the success.phtml
But after ordering, I cant see the generated html that should be generated.
I placed that code at the end of the file.
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license#magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* #category design
* #package base_default
* #copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
* #license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
123
<div class="page-title">
<h1><?php echo $this->__('Your order has been received') ?></h1>
</div>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<h2 class="sub-title"><?php echo $this->__('Thank you for your purchase!') ?></h2>
<?php if ($this->getOrderId()):?>
<?php if ($this->getCanViewOrder()) :?>
<p><?php echo $this->__('Your order # is: %s.', sprintf('%s', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?></p>
<?php else :?>
<p><?php echo $this->__('Your order # is: %s.', $this->escapeHtml($this->getOrderId())) ?></p>
<?php endif;?>
<p><?php echo $this->__('You will receive an order confirmation email with details of your order and a link to track its progress.') ?></p>
<?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) :?>
<p>
<?php echo $this->__('Click here to print a copy of your order confirmation.', $this->getPrintUrl()) ?>
<?php echo $this->getChildHtml() ?>
</p>
<?php endif;?>
<?php endif;?>
<?php if ($this->getAgreementRefId()): ?>
<p><?php echo $this->__('Your billing agreement # is: %s.', sprintf('%s', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId())))?></p>
<?php endif;?>
<?php if ($profiles = $this->getRecurringProfiles()):?>
<p><?php echo $this->__('Your recurring payment profiles:'); ?></p>
<ul class="disc">
<?php foreach($profiles as $profile):?>
<?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('%s', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id')));?>
<li><?php echo $this->__('Payment profile # %s: "%s".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description')))?></li>
<?php endforeach;?>
</ul>
<?php endif;?>
<div class="buttons-set">
<button type="button" class="button" title="<?php echo $this->__('Continue Shopping') ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
</div>
<script type="text/javascript">
<!--
/* NexTag ROI Optimizer Data */
var id = '3551264';
var rev = '<<?php echo Mage::getSingleton('core/session')->getScriptRevenue(); ?>>';
var order = '<<?php echo $this->getOrderId(); ?>>';
var cats = '<?php echo Mage::getSingleton('core/session')->getScriptCats(); ?>';
var prods = '<?php echo Mage::getSingleton('core/session')->getScriptProds(); ?>';
var units = '<?php echo Mage::getSingleton('core/session')->getScriptUnits(); ?>';
//-->
</script>
<script type="text/javascript" src="https://imgsrv.nextag.com/imagefiles/includes/roitrack.js"></script>
<?php
$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
$amount = number_format($order->getGrandTotal(),2);
?>
<?php
$orderId = $this->getOrderId();
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
$address = $order->getShippingAddress();
$backorder = false; // some backorder logic
$download = false; // some download logic
$shipDate = new Zend_Date(); // some logic to determine ship date
?>
<!-- START Trusted Stores Order -->
<div id="gts-order" style="display:none;">
<!-- start order and merchant information -->
<span id="gts-o-id"><?php echo $orderId; ?></span>
<span id="gts-o-domain">{www.theprinterdepo.com}</span>
<span id="gts-o-email"><?php echo htmlentities($customer->getEmail()); ?></span>
<span id="gts-o-country"><?php echo htmlentities($address->getCountryId()); ?></span>
<span id="gts-o-currency">USD</span>
<span id="gts-o-total"><?php echo $order->getGrandTotal(); ?></span>
<span id="gts-o-discounts">-<?php echo $order->getDiscountAmount(); ?></span>
<span id="gts-o-shipping-total"><?php echo $order->getShippingAmount(); ?></span>
<span id="gts-o-tax-total"><?php echo $order->getTaxAmount(); ?></span>
<span id="gts-o-est-ship-date"><?php echo $shipDate->toString('yyyy-MM-dd'); ?></span>
<span id="gts-o-has-preorder"><?php echo $backorder ? 'Y' : 'N'; ?></span>
<span id="gts-o-has-digital"><?php echo $download ? 'Y' : 'N'; ?></span>
<!-- end order and merchant information -->
<!-- start repeated item specific information -->
<?php foreach ($order->getAllItems() as $item): ?>
<span class="gts-item">
<span class="gts-i-name"><?php echo htmlentities($item->getName()); ?></span>
<span class="gts-i-price"><?php echo $item->getBasePrice(); ?></span>
<span class="gts-i-quantity"><?php echo (int)$item->getQtyOrdered(); ?></span>
<span class="gts-i-prodsearch-country">US</span>
<span class="gts-i-prodsearch-language">en</span>
</span>
<?php endforeach; ?>
<!-- end repeated item specific information -->
</div>
<!-- END Trusted Stores -->
UPDATE:
I removed the code as they show in the first link and I installed the magento extension that should insert the code automatically where it needs to be. After checking html on any page and in the order success page, I can see the code is really generated, I cant see the validation bar as google says.
(I still cant see the badge)
Its weird, I cant see hte html code when I right click view source, but if check with firebug lite the code is there
<div id="gts-order" style="display: none; ">
<span id="gts-o-id">900001439</span>
<span id="gts-o-domain">{www.theprinterdepo.com}</span>
<span id="gts-o-email">sam.x.x#outlook.com</span>
<span id="gts-o-country">US</span>
<span id="gts-o-currency">USD</span>
<span id="gts-o-total">449.8400</span>
<span id="gts-o-discounts">-0.0000</span>
<span id="gts-o-shipping-total">34.8500</span>
<span id="gts-o-tax-total">0.0000</span>
<span id="gts-o-est-ship-date">2012-09-18</span>
<span id="gts-o-has-preorder">N</span>
<span id="gts-o-has-digital">N</span>
<span class="gts-item">
<span class="gts-i-name">HP LaserJet Pro 100 M175nw MFP Printer</span>
<span class="gts-i-price">414.9900</span>
<span class="gts-i-quantity">1</span>
<span class="gts-i-prodsearch-country">US</span>
<span class="gts-i-prodsearch-language">en</span>
</span>
</div>

this can be done only in US ip adddresses, otherwise the validation toolbar and the preview badge wont appear. I connected to a desktop in us and then I could do all validations.

Related

Add "Starting from" in front of prices on category page in open cart store

I'm trying to edit the template and I need to add "Starting from" in front of the prices on the catalog page (and then maybe the product page, but one step at a time)
I've located where it echos the price in the tpl file
<p class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-new"><?php echo $product['special']; ?></span> <span class="price-old"><?php echo $product['price']; ?></span>
<?php } ?>
What I tried was to add a row in the oc_product table called starting_from and manually enter "Starting from" in each one. (there are only 6 products for now).
With very little knowlegde i added
<?php echo $product['starting_from']; ?>
so it then looked like this
<p class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['starting_from']; ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-new"><?php echo $product['special']; ?></span> <span class="price-old"><?php echo $product['price']; ?></span>
<?php } ?>
Shockingly, it didn't work.
Can someone try and explain the magnitude of my errors, please?
And maybe help me out.
Thank
If your want to simply add the hardcoded string Starting from, you can do:
<p class="price">Starting from
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-new"><?php echo $product['special']; ?></span> <span class="price-old"><?php echo $product['price']; ?></span>
<?php } ?>
Actually, if I got you right, this is very basic, so I'd recommend some PHP tutorial to start with.

How to make automatic selection with a hidden element

I'm developing a Wordpress-based website and posting on it requires subscription plan selection, which is part of the theme that's used. However, I don't intend on implementing different subscription plans and there would be only one free plan, so manual selection from the users is not needed. This is the code of the plan selection option that gets shown to the user when posting:
<li <?php echo $class_select; ?> data-sku="<?php echo $package->sku ?>" data-id="<?php echo $package->ID ?>" data-price="<?php echo $package->et_price; ?>"
<?php if( $package->et_price ) { ?>
data-label="<?php printf(__("You have selected: %s", ET_DOMAIN) , $package->post_title ); ?>"
<?php } else { ?>
data-label="<?php _e("You are currently using the 'Free' plan", ET_DOMAIN); ?>"
<?php } ?>
>
<span class="price">
<?php if( $package->et_price ) {
ae_price($package->et_price);
}else {
_e("Free", ET_DOMAIN);
} ?>
</span>
<span class="title-plan">
<span class="package-title"><?php echo $package->post_title .' - '; ?></span>
<span class="package-limit"><?php if($text) { echo $text; } ?></span>
<span><?php echo $package->post_content; ?></span>
</span>
<?php _e( 'Select' , ET_DOMAIN ); ?>
<div class="clearfix"></div>
</li>
I think the way to go would be to make it so that it automatically selects the one available for selection plan and hide this element from the user, so that he doesn't actually see all this and save him one step when posting. I'm not really sure how this could be accomplished, though - do you have any ideas or suggestions?
I've been developing this website for the last 4 months and this is the very last thing remaining before its completion and then it would be ready to launch. Any help would be greatly appreciated. Thank you.

Magento 1.9 Trusted Shops with reviews

I have the problem when I integrate Trusted Shops in a static block or via the plugin of Trusted Shops. The evaluation and the Stars are not on the Trusted Shops badge then the man has to insert the following Div element with the matching variables on the checkout page.
<div id="trustedShopsCheckout" style="display: none;">
<span id="tsCheckoutOrderNr">2016-05-21-001</span>
<span id="tsCheckoutBuyerEmail">mein.kunde#mail.de</span>
<span id="tsCheckoutOrderAmount">4005.95</span>
<span id="tsCheckoutOrderCurrency">EUR</span>
<span id="tsCheckoutOrderPaymentType">VORKASSE</span>
<span id="tsCheckoutOrderEstDeliveryDate">2016-05-24</span>
</div>
Now the question where can I find the variables for it or is there a simpler way to integrate that?
greetings
Leon
Add the following code to the checkout/success.phtml
/********************************************
* TRUSTED SHOPS BUYERS PROTECTION
*
* Variables needed for Trusted Shops PopOut-Card,
********************************************/
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$order = Mage::getSingleton('sales/order')->load($orderId);
$grandTotal = $order->getGrandTotal();
$currencyCode = $order->getOrderCurrencyCode();
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
$customer = Mage::getSingleton('customer/session')->getCustomer();
$email = $order->getCustomerEmail();
$paymentType = $order->getPayment()->getMethod();
?>
<div id="trustedShopsCheckout" style="display: none;">
<span id="tsCheckoutOrderNr"><?php echo $orderId ?></span>
<span id="tsCheckoutBuyerEmail"><?php echo $email ?></span>
<span id="tsCheckoutBuyerId"><?php echo $customerId ?></span>
<span id="tsCheckoutOrderAmount"><?php echo $grandTotal ?></span>
<span id="tsCheckoutOrderCurrency"><?php echo $currencyCode ?></span>
<span id="tsCheckoutOrderPaymentType"><?php echo $paymentType ?></span>
<span id="tsCheckoutOrderEstDeliveryDate"></span>
</div>
If you want to add Product Reviews too you have to add the following code before the final </div>
<!-- product reviews start -->
<?php foreach ($order->getAllVisibleItems() as $orderItem): ?>
<?php $product = $orderItem->getProduct(); ?>
<span class="tsCheckoutProductItem">
<span class="tsCheckoutProductUrl"><?php echo $product->getProductUrl() ?></span>
<span class="tsCheckoutProductImageUrl"><?php echo $product->getImageUrl() ?></span>
<span class="tsCheckoutProductName"><?php echo $product->getName() ?></span>
<span class="tsCheckoutProductSKU"><?php echo $product->getSku() ?></span>
</span>
<?php endforeach; ?>
<!-- product reviews end -->
Info:
You can also add GTIN, MPN and Brand. But this depends to your product structure. See http://www.trustedshops.de/shopbetreiber/integration/product-reviews/ for this

Return two decimal places value for the variable extracted from php code for Google Trusted Store

Below is my code for Google trusted Store. Currently it generates numeric values with four decimal places. For example, the value for this code: getGrandTotal(); ?>
it returns value in the format 25.0000 Is there a way it could be forced to return a value for 2 decimal places i.e 25.00
Thanks,
<?php
$orderId = $this->getOrderId();
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
$address = $order->getShippingAddress();
$backorder = false; // some backorder logic
$download = false; // some download logic
$shipDate = new Zend_Date(); // some logic to determine ship date
?>
<div id="gts-order" style="display:none;">
<span id="gts-o-id"><?php echo $orderId; ?></span>
<span id="gts-o-domain">www.example.com</span>
<span id="gts-o-email"><?php echo htmlentities($customer->getEmail()); ?></span>
<span id="gts-o-country"><?php echo htmlentities($address->getCountryId()); ?></span>
<span id="gts-o-currency">USD</span>
<span id="gts-o-total"><?php echo $order->getGrandTotal(); ?></span>
<span id="gts-o-discounts">-<?php echo $order->getDiscountAmount(); ?></span>
<span id="gts-o-shipping-total"><?php echo $order->getShippingAmount(); ?></span>
<span id="gts-o-tax-total"><?php echo $order->getTaxAmount(); ?></span>
<span id="gts-o-est-ship-date"><?php echo $shipDate->toString('yyyy-MM-dd'); ?></span>
<span id="gts-o-has-preorder"><?php echo $backorder ? 'Y' : 'N'; ?></span>
<span id="gts-o-has-digital"><?php echo $download ? 'Y' : 'N'; ?></span>
<?php foreach ($order->getAllItems() as $item): ?>
<span class="gts-item">
<span class="gts-i-name"><?php echo htmlentities($item->getName()); ?></span>
<span class="gts-i-price"><?php echo $item->getBasePrice(); ?></span>
<span class="gts-i-quantity"><?php echo (int)$item->getQtyOrdered(); ?></span>
<span class="gts-i-prodsearch-country">US</span>
<span class="gts-i-prodsearch-language">en</span>
</span>
<?php endforeach; ?>
</div>
Try using number_format function of PHP. For example,
<?php
$number = 25.0000;
echo number_format((float)$number, 2, '.', '');
?>
This will print
25.00
I modified the code as following to achieve the objective
<?php echo(round($order->getGrandTotal(),2)); ?>

Magento PHP Coding: Visibility = Not Visible Individually -- Still Shows Up

I have an "Also Bought" module that works just fine but after I set a product in administration to Visibility = Not Visible Individually it still shows in my also bought. Here's the code I've been working on:
<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license#magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* #category design
* #package base_default
* #copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* #license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
/**
* Shoping cart sidebar
*
* #see Mage_Checkout_Block_Cart_Sidebar
*/
$title = $this->getTitle();
$le = $this->getBoughtProducts();
/*foreach($le as $_index=>$_item){
echo $_item->getId();
}
exit;*/
$lecount=count($le );
?>
<?php if($this->getEnable()){
//echo Mage::getVersion();
?>
<div class="also-bought-wrap">
<?php if($lecount>0): ?>
<h4 class="relations"><?php echo $title; ?>
<?php if($lecount>0): ?>
<small><?php echo $this->__('(%d)', $lecount) ?></small>
<?php endif; ?></h4>
<ol id="also-bought">
<?php foreach ($le as $_index => $_item) {
// echo $_index."<hr>";
// $_item=$le[$_index];
// echo $_item->getStatus();
?>
<?php if ($_product->isVisibleInSiteVisibility()): ?> <--------------HERE
<li class="also-bought-li">
<div class="product-images">
<a href="<?php echo $_item->getProductUrl() ?>">
<img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(50); ?>" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" width="50" height="74" />
</a>
</div>
<div class="product-details">
<?php echo $this->htmlEscape($_item->getName()) ?>
<div style="font-size:9px"><?php echo $this->getPriceHtml($_item) ?>
</div>
<div class="also-bought-text">
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<a id="also-bought-wishlist" href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-cart"><?php echo $this->__('Add to Wishlist') ?></a>
<?php endif; ?>
<?php if($_item->isSaleable()): ?>
<div class="clear"></div>
<a id="also-bought-price" href="<?php echo $this->getAddToCartUrl($_item) ?>" class="link-cart"><?php echo $this->__('Add to Cart') ?></a>
<?php endif; ?>
</div>
</div>
</li>
<?php endif; ?> <-----------------HERE
<?php } ?>
</ol>
<?php else: ?>
<div class="content"><p><?php echo $this->__(' ') ?></p></div>
<?php endif ?>
</div>
<?php } ?>
Can someone please help me on this? What gets me is it seems to think the product IS visible because if I change:
<?php if ($_product->isVisibleInSiteVisibility()): ?>
to...
<?php if (!$_product->isVisibleInSiteVisibility()): ?>
then all the "Also Bought" products stop showing.
Thanks
You're checking the current product, not the 'Also Bought' product. Change the line to
<?php if ($_item->isVisibleInSiteVisibility()): ?>

Categories