InStock QTY to be display after Login - magento-1.7

I am new to Magento, In my site i want to display the categories after login, but for some categories its displaying before login and some of the categories are unable to see the In Stock after login also. Can any one please help me on this.
Thanks in Advance

I don't know if i understand your question completely, but i think you want to show your categories only after the user is logged in?
You could only show the category menu after login using
<?php if ($this->helper('customer')->isLoggedIn() ): ?>
<-- Place the things you want the show here! -->
<?php endif ;?>
So if you use this in the topmenu (app/design/frontend/yourpackage/yourtheme/template/catalog/navigation/top.phtml) it would look like this
<?php if ($this->helper('customer')->isLoggedIn() ): ?>
<?php $_menu = $this->renderCategoriesMenuHtml(0,'level-top') ?>
<?php if($_menu): ?>
<div class="nav-container">
<ul id="nav">
<?php echo $_menu ?>
</ul>
</div>
<?php endif ?>
<?php endif ;?>

Related

Forgotten Password form - Yii2 - Basic

I need a clue how to have a Forgotten email "form" that send code to some user(email box) and when he click the "code" for resetting the password,he is redirecting in the website and then he update his "forgotten password" , I make forgot.php page in "site" folder , but can someone give me some clue what must be the logic in the SiteController and etc.
forgot.php (form for the forgotten password)
<h1><?= Html::encode($this->title) ?></h1>
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'email') ?>
<div class="form-group">
<div class="col-lg-offset-1 col-lg-11">
<?= Html::submitButton('Submit', ['class' => 'btn btn-primary'])?>
</div>
</div>
<div>
<?php ActiveForm::end(); ?>
In Controller:
check user in db by email from the above email form, isExist?
exist -> generate reset_token+timestamp, and send email to user link+token+timestamp+email
User access the link, show form for new password + repeat password. But you need to set token validity by time (ex: 30 minutes).
if token valid, user can change password. else, redirect to page reset again

how to hide fax field for guest user magento

magento, At checkout page i want to hide fax field in billing address if user checkout as guest.I tried this code
if ($('login:guest') && $('login:guest').checked) {}
but it not worked.
Please give me code for this.
And i want to hide fax field in backend(customer->address).but i could not find file. Please navigate me file.
Thanks
Add the following code in your template file of shipping .
<?php $customer = Mage::getSingleton('customer/session')->getCustomer();?>
<?if($customer):?>
<div class="field">
<label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
<div class="input-box">
<input type="tel" name="shipping[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="shipping:fax" onchange="shipping.setSameAsBilling(false);" />
</div>
</div>
<?php endif;?>

Submit button for my contact form is not submitting and redirecting

I'm working on my second website and throughout creating this one and my first the people here on StackOverflow have been an amazing help.
I can just browse and find almost anything I wan't to know.
99% of problems I've had, I fixed with answers I've read on here.
So first of thank you all so much!
This is the first time I'm posting something because I'm not able to find the specific answer for my code.
There are people one here with the same problems but when I look at their code I'm just lost.
I know html a fair bit by now. It's the php that I'm clueless about.
I'm not looking for something fancy, I'm just trying to create a simple contact form.
So here is my question and code, I hope some of you are able to help me.
I used an PHP code from a youtube tutorial and it's deadeasy (as said before: first time PHP) yet I can't get it to work. Although I'm doing everything the same as the man in the clip. He shows his is working so I'm extremely curious as to way mine is not?
My form does not 'send' and after clicking the submit button I don't get the 'thank you' line.
here is the html:
<form method="post" action="contactform" name="contactform" id="contactform">
<ol>
<li>
<label for="voornaam">Voornaam</label>
<input type="text" name="voornaam" />
</li>
<li>
<label for="achternaam">Achternaam</label>
<input type="text" name="achternaam" />
</li>
<li>
<label for="telefoon">Telefoon Nummer</label>
<input type="text" name="telefoon" />
</li>
<li>
<label for="email">E-mail Adres</label>
<input type="text" name="email" />
</li>
<li>
<label for="bericht">Type hier je bericht</label>
<textarea name="bericht"></textarea>
</li>
<li>
<input name="submit" type="submit" value="submit" />
<input name="reset" type="reset" value="reset" />
</li>
</ol>
</form>
and the PHP:
<?php
$voornaam = $_POST ['voornaam'];
$achternaam = $_POST ['achternaam'];
$telefoon = $_POST ['telefoon'];
$email = $_POST ['email'];
$bericht = $_POST ['bericht'];
$to = "felicevancuyk#gmail.com";
$subject = "dkl groep bericht";
mail ($to, $subject, $bericht, "From " . $voornaam . $achternaam . $telefoon};
echo "Bedankt. We nemen zo snel mogelijk contact met u op.";
?>
It could be that your action is not set correctly:
<form method="post" action="contactform" name="contactform" id="contactform">
This action tag is the URL that the form is sent to. In the above example you gave, it doesn't appear to be a file name. You want it to be something like this:
<form method="post" action="http://mysite.com/process-form.php" name="contactform" id="contactform">
Also note that in your example PHP code you are emailing responses to the form without cleaning those responses. Someone could send malicious code to your server if you don't clean the data first.
Something like:
$cleaned_voornaam = preg_replace("/[^ 0-9a-zA-Z]/", "_", $_POST['voornaam']);
Good luck!
You have to just change your action attribute of first line of code to the page where you want to process your form. It may be the same page but it is recommend to be on another page. Here is an example to submit the form in the same page:
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="contactform" id="contactform">
Don't forget if you are submitting on the same page as like the above example then your page should be in .php extension otherwise it will not work.
Another case for submit not submitting is that html is malformed.
Just happened that my code was inserting a php error in the middle of my html form.
fixed the error, the submit is working again.
In my case, no js involved at all

Codeigniter form_open_multipart() displays blank

Been trying out codeigniter and wanted to create a very simple single file upload using the upload class. However I keep getting a blank page when trying to create a form using form_open_multipart. I've been looking around, but I can't seem to find out how to make this work.
The HTML uploadPage.php
<body>
<?php echo form_open_multipart('upload/theUpload');?>
<input type="file" name="userfile">
<input type="submit" name="submit" value="Upload File">
</form>
</body>
The controller upload.php
<? if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class upload extends CI_Controller{
function index(){
$this->load->view("uploadPage");
}
function theUpload(){
}
}

Wrong image & tekst Facebook Like Button

I'm using Facebook Like on my product pages. When somebody like's a product the wrong tekst and image is displayed on the Timeline of the User. Pinterest and Twitter are working okay.
I use Opencart version 1.5.2.1 and my buttons are from Addthis. The Pinterest button is modified for Opencart. The code i use is:
<div class="share"><!-- AddThis Button BEGIN --> <div
class="addthis_toolbox addthis_default_style "> <a
class="addthis_button_pinterest" pi:pinit:url=<?php echo
$breadcrumb['href']; ?> pi:pinit:media=<?php echo $thumb; ?>
pi:pinit:layout="none"></a> <a class="addthis_button_tweet"
tw:count="none"></a> <a class="addthis_button_facebook_like"
fb:like:width="85" /></a> </div> <script type="text/javascript"
src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f68526319f4252e"></script>
<!-- AddThis Button END -->
If someone is able to help me with this it would be very appreciated.
It was a user agent problem.
Facebook was not able to see my page.
It is solved now by putting the user agent in array.