Tuesday, 19 July 2016

magento cart url

$params = array(
                               
                                'product'=> $_product->getId(),
                                Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => Mage::helper('core/url')->getEncodedUrl(),
                                'form_key'=>Mage::getSingleton('core/session')->getFormKey(),'_secure'=>false
                                );
                                $addToCartUrl= $this->getUrl("checkout/cart/addToCartFromList/", $params ).'?super_attribute['.$super_a_id.']='.$option['value'];
                                ?>

how to get categories ids calection by product on magento

$_product->getCategoryIds();

Monday, 11 July 2016

how to cutom mail send by load templated

/app/code/local/artis/Testimonial/etc/config.xml

Add this code:-
<global>
        <template>
        <email>
        <contacts_email_configuration_select_template_post translate="label" module="testimonial">
            <label>Custom Email Template After Post Quote Request</label>
            <file>email_template_after_post_request.html</file>
            <type>html</type>
        </contacts_email_configuration_select_template_post >
        </email>
    </template>
    </global>
   
Careted this file on this path:-
app/locale/en_US/template/email/email_template_after_post_request.html

<!--@subject Testimonial submission! @-->

{{template config_path="design/email/header"}}
{{inlinecss file="email-inline.css"}}

<table cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td class="action-content">
            <h1>Dear Admin,</h1>
        </td>
    </tr>
    <tr>
        <td class="action-content">
            <p>Name: {{var name }}</p>
        </td>
    </tr>
    <tr>
        <td class="action-content">
            <p>Company: {{var company }}</p>
        </td>
    </tr>
    <tr>
        <td class="action-content">
            <p>Email: {{var email }}</p>
        </td>
    </tr>
    <tr>
        <td class="action-content">
            <p>Telephone {{var telephone }}</p>
        </td>
    </tr>
        <tr>
        <td class="action-content">
            <p>Wire / Cable Description: {{var description }}</p>
        </td>
    </tr>
            <tr>
        <td class="action-content">
            <p>Length: {{var length }}</p>
        </td>
    </tr>
                <tr>
        <td class="action-content">
            <p>Date Required: {{var drequired }}</p>
        </td>
    </tr>
    <tr>
        <td class="action-content">
            <p>Additional Questions / Comments: {{var acomments}}</p>
        </td>
    </tr>
</table>       

{{template config_path="design/email/footer"}}



/app/code/local/Artis/Contacts/controllers/IndexController.php
==================
 public function quoterequestAction()
    {
        $post = $this->getRequest()->getPost();
        if ( $post ) {
           
            $emailTemplate = Mage::getModel('core/email_template')->loadDefault('contacts_email_configuration_select_template_post');
            $emailTemplateVariables = array();
            $emailTemplateVariables = array();
            $emailTemplateVariables['name'] = $post['name'];
            $emailTemplateVariables['companyname'] = $post['companyname'];
            $emailTemplateVariables['email'] = $post['email'];
            $emailTemplateVariables['telephone'] = $post['telephone'];
            $emailTemplateVariables['description'] = $post['description'];
            $emailTemplateVariables['length'] = $post['length'];
            $emailTemplateVariables['drequired'] = $post['drequired'];
            $emailTemplateVariables['acomments'] = $post['acomments'];
            //print_r($emailTemplateVariables);exit;
           
           
          
            $emailTemplateVariables['customer_email'] = $post['email'];
           
            $emailTemplate->getProcessedTemplate($emailTemplateVariables);
           
            $emailTemplate->setSenderName($post['name']);
            $emailTemplate->setSenderEmail($post['email']);
           
            $recipientName = 'test';
            $recipientEmail = 'artis.test70@gmail.com';
           
            $emailTemplate->send($recipientEmail,$recipientName,$emailTemplateVariables);
        }
    }
==========================

============ Form page:- ==================================
<div class="col-md-9">
<div class="quest-quote-outer">
    <h3>Quote Request</h3>
    <p><strong>Can't find what you are looking for or just want to request a quote?</strong> Fill out the form below or give us a call at (516) 606-6537 or send us an email at <strong><a href="mailto:sales@nassaunationalcable.com">sales@nassaunationalcable.com</a></strong></p>
    <h4>We guarantee same day response!</h4>
    <p>
        Phone: (516) 606-6537</br>E-Fax: (480) 287-9579</br>Fax: (516) 482-6438</br>Email: <a href="mailto:sales@nassaunationalcable.com">sales@nassaunationalcable.com</a>
    </p>
        <form method="post" id="qutote-form" name="qutote-form" class="qutote-form" action="<?php echo Mage::getUrl(); ?>contacts/index/quoterequest/">
        <div class="qutote-form-row1">
            <h3 class="legend">Contact Information</h3>
            <ul class="form-list">
                <li class="fields">
                    <div class="field name">
                        <label  class="required">Name:</label>           
                        <div class="input-box">
                            <input type="text" name="name" id="name" class="input-text required-entry" style="" value="" />                                       
                        </div>
                    </div>
                    <div class="field company">
                        <label for="field_15">Company:</label>               
                        <div class="input-box">
                            <input type="text" name="companyname" id="companyname" class="input-text" style="" value="" />                                                   
                        </div>
                    </div>
                </li>
                <li class="fields">
                    <div class="field email">
                        <label class="required">Email:</label>                   
                        <div class="input-box">
                            <input type="text" name="email" id="email" class="input-text required-entry validate-email" style="" value="" />                   
                        </div>
                    </div>
                    <div class="field webforms-fields-telephone">
                        <label>Telephone:</label>           
                        <div class="input-box">
                            <input type="text" name="telephone" id="telephone" class="input-text" style="" value="" />                                           
                        </div>
                    </div>
                </li>
            </ul>
        </div>
        <div class="qutote-form-row2">
            <h3 class="legend">Contact Information</h3>
            <ul class="form-list">
                <li class="wide">
                    <label  class="required">Wire / Cable Description:</label>
                    <div class="input-box">
                        <textarea name="description" id="description" class="input-text required-entry wire-request-details" style=""></textarea>                   
                    </div>
                </li>
                <li class="fields">
                    <div class="field length">
            <label class="required">Length:</label>
            <div class="input-box">
                        <input type="text" name="length" id="length" class="input-text required-entry" style="" value="" />
            </div>
                    </div>
                    <div class="field date-needed">
            <label >Date Required:</label>
            <div class="input-box">
                        <input type="text" name="drequired" id="drequired" class="input-text " style="" value="" />
            </div>
                    </div>
                </li>
                <li class="wide">
            <div class=" webforms-fields-comments">
                        <label>Additional Questions / Comments:</label>           
                        <div class="input-box">
                            <textarea name="acomments" id="acomments" class="input-text" style=""></textarea>               
                        </div>
                    </div>
        </li>
            </ul>
        </div>
        <div class="buttons-set">
            <p class="required">* Required Fields</p>
            <input type="submit" value="submit" class="r-submit">
        </div>
       
    </form>
</div>
</div>




<div class="col-md-3">
<?php echo  $this->getLayout()->createBlock('cms/block')->setBlockId('right-block')->toHtml();?>
</div>


<script type="text/javascript">
//<![CDATA[
    var contactForm = new VarienForm('qutote-form', true);
//]]>
</script>
===========================================

Sunday, 10 July 2016

how to enable the product review form anywhere

catalog.xml enable it with:

<block type="review/form" name="product.info.review_form" as="review_form" template="review/form.phtml"/>
and in your template:

<?php echo $this->getChildHtml('review_form'); ?>

Saturday, 9 July 2016

how to displaying review block (with ratings) on custom page in magento

<?php
$_product = $_item->getProduct(); //get the product in cart
$storeId = Mage::app()->getStore()->getId();
$summaryData = Mage::getModel('review/review_summary')
->setStoreId($storeId)
->load($_product->getId());

if ($summaryData['rating_summary']):?>
<div class="ratings">
<div class="rating-box">
<div class="rating" style="width:<?php echo $summaryData['rating_summary']; ?>%"></div>
</div>
</div>
<?php endif; ?>

Thursday, 7 July 2016

how to remove product wishlist remove custom page on magento

Customer account controllers path :-
/app/code/local/Companyname/Customer/controllers

public function wishlistRemoveAction(){
        $proid= $_REQUEST['proid'];
        $customerid= $_REQUEST['customerid'];
       
        $itemCollection = Mage::getModel('wishlist/item')->getCollection()->addCustomerIdFilter($customerid);
        foreach($itemCollection as $item) {
        if($item->getProductId()==$proid)
            $item->delete();
        }
       
    }

 List page :-

<input type="hidden" id="remove_url" value="<?php echo $this->getUrl();?>customer/account/wishlistRemove"/>

<a href="javascript:void(0)" class="link-wishlist click-remove" data-proid="<?php echo $_product->getId(); ?>" data-customerid="<?php echo $customerId; ?>">
                                <i class="fa fa-star-o"></i>
                            </a>

JQuery :-


jQuery('.click-remove').click(function() {
    var base_url=jQuery.trim(jQuery("#remove_url").val());
    var pro_Id=jQuery(this).data('proid');
    var customerid=jQuery(this).data('customerid');
    //alert(base_url);
    jQuery.ajax({
           url: base_url,
           type:  'post',
           data:({'proid':pro_Id,'customerid':customerid}),
           success: function(msg){
        location.reload();
           }
       });
      
    });

Monday, 4 July 2016

category attributes select type in magento

require_once('app/Mage.php');
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup;
$attribute = array(
'type' => 'int',
'label'=> 'Is Embroidery Country Ribbon',
'input' => 'select',
'source' => 'eav/entity_attribute_source_boolean',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => 0,
'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'isembroiderycribbon', $attribute);
$installer->endSetup();