Search

shamjascp

This WordPress.com site is the bee's knees

Month

August 2015

command propmpt Run as administrator

Image

Advertisements

Laravel 4 Windows server hosting

  1. mod_rewrite is enabled
  2. permission sholud be given for all storage folder and image upload folder
  3. web .config should download from laravel windows configuration or copy from below
  4. <?xml version=”1.0″ encoding=”UTF-8″?>
    <configuration>
    <system.webServer>
    <directoryBrowse enabled=”false” />

    <rewrite>
    <rules>
    <rule name=”Imported Rule 1″>
    <match url=”^(.*)$” ignoreCase=”false” />
    <action type=”Rewrite” url=”{R:1}” />
    </rule>
    <rule name=”Imported Rule 2″ stopProcessing=”true”>
    <match url=”^(.*)$” />
    <conditions logicalGrouping=”MatchAll”>
    <add input=”{REQUEST_FILENAME}” matchType=”IsFile” ignoreCase=”false” negate=”true” />
    <add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” ignoreCase=”false” negate=”true” />
    </conditions>
    <action type=”Rewrite” url=”index.php/{R:1}” />
    </rule>
    </rules>
    </rewrite>

    </system.webServer>
    </configuration>

  5. if we got error like internal server in some part of  admin means we have problem in some controller -> then we need to check laravel log -> the solution i have got in
  6. if(!empty(Input->get()) ->replace to input variable in to one variable
  7. $temp=Input->get(); and then check  !if(empty($temp))

for image upload we use intervention package but we need to enable fileinfo () module ,currently we dont have option to enable so we used simple image plugin

Magento: How to create an unsubscribe link and page

1. Create a  “unsubscribe.phtml” page with the following location    /app/design/frontend/your_package/your_theme/template/newsletter/unsubscribe.phtml  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?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->__('Unsubscribe') ?></span></span></button>
            </div>
        </div>
    </form>
    <script type="text/javascript\">
        //<![CDATA[
        var newsletterSubscriberFormDetail = new VarienForm('newsletter-validate-detail');
        //]]>
    </script>
</div>

2. in admin cms section, Create a CMS page Name ‘Unsubscribe’ and url ‘unsubscribe’ and call that “unsubscribe.phtml” page in your cms page.and in content section add following code

{{block type=”core/template” template=”newsletter/unsubscribe.phtml”}}
3. Now in page /app/design/frontend/your_package/your_theme/template/newsletter/subscribe.phtml add the follwing code to add a link to the cms page.

1
2
3
<div class="unsubscribe">
    <a href="<?php echo Mage::getUrl('unsubscribe') ?>"><?php echo $this->__('Unsubscribe') ?></a>
</div>

4.Now in /app/code/core/Mage/Newsletter/Block/Subscribe.php add a function to create the form action url which is called in the “unsubscribe.phtml”.

1
2
3
4
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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/** * 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();
}

Note: Remove Cache and refresh.

Create a free website or blog at WordPress.com.

Up ↑