Change to guest only checkout on Magento 1.7 - magento

I would like to move to a guest only checkout on a Magento 1.7 install.
I have come across extensions which do this for older versions. I have also come across solutions like this http://www.mageroots.com/always-checkout-as-guest/ but my file structure is different from this tutorial.
I have a template installed bought fron template monster

The solution I've found sometime ago this, but has disappear for some reason:
Edit : checkout/onepage.phtml
right after:
<?php $i=0; foreach($this->getSteps() as $_stepId => $_stepInfo): ?>
Copy the following:
<?php /* Guest check out only - Start */ ?>
<?php if($_stepId == 'login'): ?>
<li style="display: none;">
<input type="hidden" name="checkout_method" id="login:guest" value="guest" checked="checked" />
<script type="text/javascript">
Event.observe(window, 'load', function() {
var cb = $("login:guest");
cb.checked = true;
checkout.setMethod();
});
</script>
</li>
<?php continue; endif; ?>
<?php /* Guest check out only - end */ ?>
it did the trick for me

Related

Load an HMVC module view within an Iframe in Codeigniter

I'm new at this and some help will be apprciated.
I'm building a sidebar in a CI-Boilerplate-Project which contains modules (widgets) that i got run with HMVC https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc.
In the sidebar i have a widget that display a friendslist with status online/offline.
The user has the ability to switch the widgets on/off in the managementsection.
In the Profileview:
<aside class="sidebox right">
<?php foreach ($boxes as $boxName => $boxSetting)
{
echo Modules::run($boxName, $boxSetting['box_visible']);
}
?>
</aside>
if box_visible == 1 the widget will be displayed.
Controller:
class Myfriends extends SM_Controller
{
function __construct()
{
parent::__construct();
}
public function index($visible = false)
{
$user = $this->session->userdata('user');
$myf = $this->widget_model->get_friends($user['user_id'], 5);
$data['friends'] = $myf;
if ($visible) $this->load->view('myfriends', $data);
}
}
View:
<html>
<head>
<meta http-equiv="refresh" content="5">
</head>
<body>
<div class="box friendsbox">
<div id="header"><h3><?=$boxTitle?></h3></div>
<div id="boxcontent">
<ul>
<?php foreach ($friends as $friend): ?>
<li>
<div id="thb_img">
<img src="<?=img_thumb($friend['file_path'], 50, 50) ?>" />
</div>
<div id="short_desc">
<a href="<?= site_url('widget_functions/show_user/' . $friend['uu_id']) ?>">
<?= ucfirst($friend['user_name']) . ' ' . ucfirst($friend['user_lastname']) . ' ' ?>
</a>
<?php if ($friend['is_online']): ?>
<span style="color: green">online</span>
<?php endif; ?>
</div>
</li>
<?php endforeach; ?>
</ul>
</div>
<div id="footer">» mehr</div>
</div>
</body>
</html>
Now, i need to update the friendslist every 1-2 min so i tryed to load the moduleview within an iframe:
<aside class="sidebox right">
<?php foreach ($boxes as $boxName => $boxSetting): ?>
<?php if ($boxName == 'myfriends' && $boxSetting['box_visible'] == 1) { ?>
<iframe src="<?php echo site_url('myfriends/index'); ?>" ></iframe>
<?php
}
else
{
echo Modules::run($boxName, $boxSetting['box_visible']);
}
?>
<?php endforeach; ?>
</aside>
BUT this dose not work! The place of the widget is emtpy.
Do you have any idea how to get that to work?
appreciate your help
I believe the main issue is with the way you initialize the index method. the index method is kinda tricky with parameters in Codeigniter. In my projects, the only way to get the vlues of arguments passed to the index parameters is by using the URI library method $this->uri->segment(n). In other words, I believe that the value of $visible is not properly passing to the index() body
Anyway, I think you should create another method in your MyFriends Class called render() for example, and call it instead of relaying on the index() method. now render() can play nicely with the $visible=false initialization trick.
Hope this helps

Magento : Products not showing in Product Sitemap (catalog/seo_sitemap/product/ )

Well we are not able to get the products to display in the product sitemap which is by default available in magento at (http://sitename.com/catalog/seo_sitemap/product/).
We have the following code present in the app/design/frontendbase/default/template/catalog/seo/sitemap.phtml
<?php
/**
* #see Mage_Catalog_Block_Seo_Sitemap_
*/
?>
<?php $_items = $this->getCollection(); ?>
<? //var_dump($_items);?>
<?php if($_items->getSize()): ?>
<ul class="sitemap">
<?php foreach ($_items as $_item): ?>
<li><?php echo $this->escapeHtml($_item->name) ?></li>
<?php endforeach; ?>
</ul>
<?php else: ?>
<p class="note-msg">
<?php echo $this->__('There are no %s available.', $this->getItemsTitle()); ?>
</p>
<script type="text/javascript">
//<![CDATA[
if ($('sitemap_top_links') != undefined) {
$('sitemap_top_links').hide();
}
//]]>
</script>
<?php endif ?>
We tried to var_dump($_items) the product sitemap page and we were able to get the data dump of product however $_items->getSize() returns 0 and the foreach is not able to parse the $_items array.
Is there a magento backend setting or a product attribute that controls the sitemap behavior. Also the category sitemap seems to be working fine so the issue is specific to products.

Hiding Magento's Layered Navigation from Search Engines

I’m hoping someone can help me with this problem I’ve been trying to solve for the past few days. I want to hide Magento’s Layered Navigation from the search engines entirely, but make it available to users. For SEO reasons, I don’t want to settle for NoFollowing all the links, or using noindex follow meta tags, or even blocking it entirely with Robots.txt. The most effective way of handling this would be only showing the layered Navigation to users with Cookies enabled, since Google doesn’t use cookies. The same effect could probably be achieved with JavaScript as well, but I’ve chosen the Cookie method.
So far I’ve managed to implement a crude piece of JS to check if cookies are enabled once the page has loaded (adapted from another thread on this forum). If cookies are enabled, it does nothing and layered nav displays, but if cookies are not enabled, I want to remove the “catalog.leftnav” block. I can’t for the life of me figure out how to do this from my JS script. All I’ve been able to achieve is removing the div element, or setting style.display to none etc., and while all of these techniques remove the links from the frontend, Google can still see them all. Here’s an example of the code I have so far in template/catalog/layer/filter.phtml
<div id="shop-by-filters">
<ol>
<?php foreach ($this->getItems() as $_item): ?>
<li>
<?php if ($_item->getCount() > 0): ?>
<?php echo $_item->getLabel() ?>
<?php else: echo $_item->getLabel() ?>
<?php endif; ?>
<?php if ($this->shouldDisplayProductCount()): ?>
(<?php echo $_item->getCount() ?>)
<?php endif; ?>
</li>
<?php endforeach ?>
</ol>
</div>
<script type="text/javascript">
if (navigator.cookieEnabled) {
return true;
} else if (navigator.cookieEnabled === undefined) {
document.cookie = "testcookie";
if (cookie_present("testcookie"))
return true;
} else {
var elem = document.getElementById('shop-by-filters');
elem.parentNode.removeChild(elem);
}
</script>
Can anyone help me with this, or is there a better way of going about it? Please keep in mind that I am still trying to get my head around Magento, so I might need some instructions if the implementation is complicated.
Thank you.
Brendon
I'm not sure if the Google robot will reliably parse your javascript.
You may be better off hiding the layered nav based on the current session with php.
<?php if (Mage::getSingleton('customer/session')): ?>
...your nav code...
<?php endif ?>
First of all, Javascript will do nothing to stop Google from indexing that content.
Why don't you want 'to settle for NoFollowing all the links'? That is exactly what NoFollow is for. You can also tell Google to not pay attention to the qualifiers/query strings in Webmaster Tools.
If for some reason you really wanted to hide that block from Google, edit the template and string compare $_SERVER['HTTP_USER_AGENT'] against Google's very public list of user agents here http://support.google.com/webmasters/bin/answer.py?hl=en&answer=1061943
EDIT -- string compare
<?php if (stripos($_SERVER['HTTP_USER_AGENT'], 'Googlebot') !== false): ?>
<div id="shop-by-filters">
<ol>
<?php foreach ($this->getItems() as $_item): ?>
<li>
<?php if ($_item->getCount() > 0): ?>
<?php echo $_item->getLabel() ?>
<?php else: echo $_item->getLabel() ?>
<?php endif; ?>
<?php if ($this->shouldDisplayProductCount()): ?>
(<?php echo $_item->getCount() ?>)
<?php endif; ?>
</li>
<?php endforeach ?>
</ol>
</div>
<?php endif; ?>
It is a slick subject. We used this code to hide the layered navigation from Google, but we are not sure is it working...
<div id="filters-no-follow"></div>
<?php
function prepare_for_echo($string) {
$no_br = trim(preg_replace('/\s+/', ' ', $string));
$no_slashes = str_replace('\'', '\\\'', $no_br);
return $no_slashes;
}
?>
<script>
function please_enable_cookies() {
var f = document.getElementById('filters-no-follow');
f.innerHTML = '<div class="no-cookies-error">Enable cookies to choose filters.</div>';
}
function please_load_filters() {
var f = document.getElementById('filters-no-follow');
f.innerHTML = '<?php if ( !empty($filtersHtml) || !empty($stateHtml) ): ?>'
+ '\n<div class="block block-layered-nav">'
+ '\n <div class="block-title">'
+ '\n <strong><span><?php echo prepare_for_echo($this->__('Shop By')); ?></span></strong>'
+ '\n </div>'
+ '\n <div class="block-content">'
+ '\n <?php echo prepare_for_echo($this->getStateHtml()); ?>'
+ '\n <?php if ($this->canShowOptions()): ?>'
+ '\n <p class="block-subtitle"><?php echo prepare_for_echo($this->__('Shopping Options')); ?></p>'
+ '\n <dl id="narrow-by-list">'
+ '\n <?php echo prepare_for_echo($filtersHtml); ?>'
+ '\n </dl>'
+ '\n <?php endif; ?>'
+ '\n </div>'
+ '\n</div>'
+ '\n<?php endif; ?>';
}
function are_cookies_enabled()
{
var cookieEnabled = (navigator.cookieEnabled) ? true : false;
if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled)
{
document.cookie="testcookie";
cookieEnabled = (document.cookie.indexOf("testcookie") != -1) ? true : false;
}
return (cookieEnabled);
}
if(are_cookies_enabled()) {
please_load_filters();
} else {
please_enable_cookies();
}
</script>

magento: how to show custom attributes from general tab in front page automatically

when we upload one product, there is a default attribute set "Default", and in the general tab, there are many default attributes like below image:
well, i added one more custom attribute named "size", when i drag 'size' to general tab on the left, that mean the product has one more attribute. if i want to show the size attribute in the product view page of front end page, i have to put the code: "$_product->getAttributeText('size')", if i added lots of custom attributes, i have to put lots of codes manually. so, my question is how i can show all custom attributes automatically instead of adding one by one manually ?
This is allready done by magento.
Mark your attributes as vissible in frontend and thats it.
Have a look at the template attributes.phtml in path app/design/frontend/yourtheme/default/template/catalog/product/view
<?php if($_additional = $this->getAdditionalData()): ?>
<!--h2><?php echo $this->__('Additional Information') ?></h2-->
<div class="data-table accordion" id="product-attribute-specs-table">
<?php foreach ($_additional as $_data): ?>
<?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) != '')) { ?>
<div class="clearer <?php echo $this->htmlEscape($this->__($_data['label'])) ?>">
<div class="trigger"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></div>
<div class="triggerContent" style="display: none;"><span><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></span></div>
</div>
<?php } ?>
</div>
<script type="text/javascript">decorateTable('product-attribute-specs-table')</script>
You need to copy the default file from /app/design/frontend/base/default/template/catalog/product/view to your theme directory
/public_html/app/design/frontend/default/yourtheme/template/catalog/product/view

magento: onepagecheckout, stuck on billing information

Magento: onepagecheckout, stuck on billing information
This is the response we got:
When I look # the code in http://baleinen.com/checkout/onepage/ I cannot find an block called shipping-method.
Any ideas howto fix? (and this is the Sentana template, I almost cant imagine that this hasnt worked before)
{"goto_section":"shipping_method","update_section":{"name":"shipping-method","html":" <dl class=\"sp-methods\">
<dt>Betaal en verzendkosten (PostNL)<\/dt>
<dd>
<ul>
<li>
<span class=\"no-display\"><input name=\"shipping_method\" type=\"radio\" value=\"flatrate_flatrate\" id=\"s_method_flatrate_flatrate\" checked=\"checked\" \/><\/span>
<label for=\"s_method_flatrate_flatrate\">NL <span class=\"price\">\u20ac\u00a01,25<\/span> <\/label>
<\/li>
<\/ul>
<\/dd>
<\/dl>
<script type=\"text\/javascript\">
\/\/<![CDATA[
var shippingCodePrice = {'flatrate_flatrate':1.25};
$$('input[type=\"radio\"][name=\"shipping_method\"]').each(function(el){
Event.observe(el, 'click', function(){
if (el.checked == true) {
var getShippingCode = el.getValue();
var newPrice = shippingCodePrice[getShippingCode];
if (!lastPrice) {
lastPrice = newPrice;
quoteBaseGrandTotal += newPrice;
}
if (newPrice != lastPrice) {
quoteBaseGrandTotal += (newPrice-lastPrice);
lastPrice = newPrice;
}
checkQuoteBaseGrandTotal = quoteBaseGrandTotal;
return false;
}
});
});
\/\/]]>
<\/script>
"},"allow_sections":["shipping"],"duplicateBillingInfo":"true"}
http://baleinen.com/checkout/onepage/
I had a similar issue with OnePage Checkout not completing.
I had to make the following change:
app/design/frontend/base/default/template/checkout/onepage/payment.phtml
Find the folowing section:
<form action="" id="co-payment-form">
<fieldset>
<?php echo $this->getChildHtml('methods') ?>
</fieldset>
</form>
and add an id to the fieldset element:
<form action="" id="co-payment-form">
<fieldset id="checkout-payment-method-load">
<?php echo $this->getChildHtml('methods') ?>
</fieldset>
</form>
Now my checkout proceeds OK.
Problem was that Magento JS was trying to find col-right, when there was none.
This is col-left and reported as a small defect because it i hardcoded in JS

Resources