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
Related
I have to pass the value to controller page using link format.
My view page code for link:
<form action="<?=site_url('Account_Master/Tax_Save')?>" method="POST">
<head><h5><center>TAX SLAB ENTRY</center></h5><button type="submit" class="btn bg-slate"><i class="icon-file-plus position-left"></i>Ok</button>
<a id="button" method="POST" href="<?=site_url('Account_Master/get_data')?>" class="btn bg-info"><i class="icon-book3 position-left"></i> View All</a>
</head>
<div id="item1">
Tax Type: <input type="text" style="height: 28px; width:250px; " id="taxtype" name="taxtype">
</div>
When i clicked the view all button type link the value of the tax type should be pass to controller page.But i have written code to post the value but the value is not passed.
My controller code:
public function get_data(){
$tax = $this->input->post('taxtype');
print_r($tax);
$data['query']= $this->db->query("SELECT * FROM tax where taxtype ='$tax' ")->row();
$this->load->view('Account_Master/Tax_Setting1', $data, FALSE);
}
I have so far tired this code the value of the taxtype is not passed to the controller
hello I hope there is a problem with your code if I may say
Edited Part
Base on getting the input value which is not possible on button click can be done using jquery js library
html file
<form id="form" action="<?php echo site_url('Account_Master/Tax_Save');?>" method="POST">
<head>
<h5>
<center>TAX SLAB ENTRY</center>
</h5>
<button type="submit" class="btn bg-slate">
<i class="icon-file-plus position-left"></i>
Ok
</button>
<a id="button" href="<?php echo site_url('Account_Master/get_data/');?>" class="btn bg-info">
<i class="icon-book3 position-left"></i>
View All
</a>
</head>
<div id="item1">
Tax Type:
<input type="text" style="height: 28px; width:250px; " id="taxtype" name="taxtype">
</div>
</form>
Place this code just before your closing body tag
<script src="http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('#form').on('click', '#button', function(event){
event.preventDefault();
var form_box = $(this).parents('#form'),
tax_value = form_box .find('input').val(),
link_url = $(this).attr('href'),
url = link_url+tax_value;
form_box.attr('action', url);
form_box.submit()
})
})
</script>
Then in your controller,
either you do this
public function get_data($tax_value){
$tax = $tax_value;
print_r($tax);
$data['query']= $this->db->query("SELECT * FROM tax where taxtype ='$tax' ")->row();
$this->load->view('Account_Master/Tax_Setting1', $data, FALSE);
}
OR
public function get_data(){
$tax = $this->input->post('taxtype');
print_r($tax);
$data['query']= $this->db->query("SELECT * FROM tax where taxtype ='$tax' ")->row();
$this->load->view('Account_Master/Tax_Setting1', $data, FALSE);
}
I hope this help you if not let me know your argument okay... I am here to help
On the Homepage I have called the content of Custpm Post Type with Ajax with this code
jQuery(document).ready(function($){
$.ajaxSetup({cache:false});
$(".sector_item a").click(function(){
var post_link = $(this).attr("href");
$(".sector_item_content").html("<div class='load' style='position:relative;margin-top:50px;padding-bottom:50px;'><img src='<?php bloginfo("template_url"); ?>/images/ajax-loader.gif'></div>");
$(".sector_item_content").load(post_link);
return false;
});
});
But In the single Page of this same Post Type I need to have another design with content so how I can detect the single page. I tried with Wordpess is_single() function but it doesnt work it displayed anyway in ajax.How Can I fix this?
Here is my single template.php
<?php if(is_singular('sector' )){
echo 'Single page' ;
}else{
while (have_posts() ) : the_post(); ?>
<div class="container single_page_inner">
<div class="row clearfix">
<div class="col-md-10 column" style="float:none;margin:auto;">
<div class="sector_single_title">
<?php the_title();?>
</div>
<div class="single_sector_contentmain"> <?php the_content();?></div>
<div class="single_sector_more">
<img src="<?php bloginfo(template_url);?>/images/single_secormoreline.png"/>
<div class="single_sector_button">
<span class="single_sec_leftline"></span>
<span class="single_sec_rightline"></span>
Click Here To Read More
<div class="more_line"></div>
</div>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
If you want to be able to do different things when your single.php files is loaded from Ajax, you need to tell it somehow when it is getting an Ajax request.
One approach would be to add a parameter to your call, like this:
var post_link = $(this).attr("href") + '?isajax=1';
Then in your single.php file, test for this parameter:
<?php if(!empty($_GET['isajax'])){
// This is Ajax - display in Ajax format
} else {
// This is not Ajax - display in standard single.php format
}
use this:
is_singular('YOUR_POST_TYPE' );
CODEX
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
I would like to create a direct unsubscribe page in magento, I found this instruction to follow but the steps 1 and 2 are not clear As I'm not a professional.
Can someone please help me clarify these two steps. Where to create the "unsubscribe.phtml" page? How to add the just created block in it?
Thank you in advance.
1. Create a phtml page say “unsubscribe.phtml” containing the code to create the unsubscribe form.
<?php $newsletterObj = new Mage_Newsletter_Block_Subscribe(); ?>
<div class="newsletter-unsubscribe">
<div class="newsletter-unsubscribe-title"><?php echo $this->__('Submit your email id to unsubscribe newsletter') ?></div>
<form action="<?php echo $newsletterObj->getUnsubscribeFormActionUrl() ?>” method="post" id="newsletter-validate-detail">
<div class="block-content">
<div class="input-box">
<input type="text" name="email" id="newsletter" title="<?php echo $this->__('Sign up for our newsletter') ?>” class="input-text required-entry validate-email” value="<?php echo $this->__('Enter Your Email Here') ?>” onfocus="if(this.value==’<?php echo $this->__('Enter Your Email Here') ?>’)this.value=’’;” onblur="if(this.value==’’)this.value=’<?php echo $this->__('Enter Your Email Here') ?>’;”
/>
</div>
<div class="actions">
<button type="submit" title="<?php echo $this->__('Submit') ?>” class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
</div>
</div>
</form>
<script type="text/javascript\">
//<![CDATA[
var newsletterSubscriberFormDetail = new VarienForm(’newsletter-validate-detail’);
//]]>
</script>
</div>
2) Create a CMS page. Add the just created block in it. So that your CMS page will contain that form.
3) Now in page \app\design\frontend\base\default\template\newsletter\subscribe.phtml add the code to add a link of the cms page.
<div class="unsubscribe">
<?php echo $this->__('Unsubscribe') ?>
</div>
4) In page \app\code\core\Mage\Newsletter\Block\Subscribe.php add a function to create the form action url which is called in the “unsubscribe.phtml”.
public function getUnsubscribeFormActionUrl()
{
return $this->getUrl(’newsletter/subscriber/unsubscribecus’, array(’_secure’ => true));
}
5) Now in \app\code\core\Mage\Newsletter\controllers\SubscriberController.php page add new action for unsubscribe process.
/**
* Unsubscribe newsletter from frontend
*/
public function unsubscribecusAction()
{
$email = $this->getRequest()->getParam(’email’);
$subsModel = Mage::getModel(’newsletter/subscriber’);
$subscriber = $subsModel->loadByEmail($email);
$id = (int) $subsModel->getId();
$code = (string) $subsModel->getCode();
if ($id && $code) {
$session = Mage::getSingleton(’core/session’);
try {
Mage::getModel(’newsletter/subscriber’)->load($id)
->setCheckCode($code)
->unsubscribe();
$session->addSuccess($this->__(’You have been unsubscribed.’));
}
catch (Mage_Core_Exception $e) {
$session->addException($e, $e->getMessage());
}
catch (Exception $e) {
$session->addException($e, $this->__(’There was a problem with the un-subscription.’));
}
}
$this->_redirectReferer();
}
Since a can't leave a comment and this question isn't marked as solved yet, i'll assume you still need an answer.
I would suggest placing the unsubscribe.phtml file in /template/newsletter/
For step 2 you can use this code
{{block type="core/template" template="newsletter/unsubscribe.phtml"}}
so the page will contain your form.
If you already figured out how to do this, please post an answer to your own question further on.
Would it be an idea to add an unsubscribe button next to the subscribe button (or allow for a variable in the block call that sets it to yes/no display) - this way you capture both
I'm looking for a way to check if a link exists on a certain page. I know that this is possible with a ping, but I really don't know how to do this.
What I have is a list of links to other webpages, they should have a backlink to my page also. I want to check this, when the backlink is there, a text should appear, something like "ok" and when the result is negative, something like "no backlink"
I know the urls of the pages where my link should appear, in case you need to know that.
Any help would be great!
I have found a piece of code wich I think could be used to serve my needs. I self don't know how, but it would be great if anyone can help me with this.
This is the code:
<html>
<head>
<script language="javascript" type="text/javascript">
<!--
var ajax = new XMLHttpRequest();
function pingSite() {
ajax.onreadystatechange = stateChanged;
ajax.open('GET', document.getElementById('siteToCheck').value, true);
ajax.send(null);
}
function stateChanged() {
if (ajax.readyState == 4) {
if (ajax.status == 200) {
document.getElementById('statusLabel').innerHTML = "Success!";
}
else {
document.getElementById('statusLabel').innerHTML = "Failure!";
}
}
}
-->
</script>
</head>
<body>
Site To Check:<br />
<input type="text" id="siteToCheck" /><input type="button" onclick="javascript:pingSite()" />
<p>
<span id="statusLabel"></span>
</p>
</body>
You can't natively use Javascript to parse external domains, I used a proxy page which sniffs the content and feeds it to the ajax callback.
My solution basically grabs the source of the site to check and sees if a string, which can be your site link matches. I would assume this should be sufficient rather than trying to parse and look for anchors, but you can be as thorough as you want ( parse the whole thing as a DOM element and look for href attribute value ).
Let me know if you run into any issues.
<?php
$query = isset($_POST['submitted']) ? true : false;
if ( $query ) {
$url = #file_get_contents( $_POST['site-url'] );
if ( $url && strlen( $url ) > 0 ) {
$checkFor = $_POST['check-for'];
$match = preg_match( '/' . $checkFor . '/', $url );
echo $match ? 'string (link) is found' : 'string not found';
} else {
echo 'could not connect to site..';
}
exit;
}
?>
<form action="" id="site-checker">
<div class="field">
<label for="site-url">Site to check:</label>
<input id="site-url" name="site-url" value="http://jquery.com">
</div>
<div class="field">
<label for="check-for">Check for:</label>
<input id="check-for" name="check-for" value="docs.jquery.com">
</div>
<input type="hidden" name="submitted" value="true">
<input type="submit">
</form>
<div id="result"></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script>
$('#site-checker').submit(function(e) {
e.preventDefault();
$.ajax({
url:'check.php',
type:'POST',
data:$('#site-checker').serialize(),
success:function(html) {
$('#result').html( html );
}
});
});
</script>
IMHO it would be better to perform this task in a server side script. Depending on your platform there might be functions for sending HTTP requests and HTML parsing which is what you need here. Javascript has cross domain restrictions which will prevent you from sending ajax requests to different domains than the one that is hosting the web page.