Skip to main content

Posts

Showing posts with the label magento

photo upload field error in magento

Below i have added the code to upload photo. Well i have added photo upload in edit.phtml page only but in register.phtml magento showing error. Can anyone fix it ? error message : Wrong entity ID. app/design/frontend/default/blue/template/customer/form/register.phtml <?php $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $attr2 = array ( 'position' => 1, 'is_required'=>1 ); $setup->addAttribute(’61’, ‘photo’, $attr2); ?> app/design/frontend/default/blue/template/customer/form/edit.phtml <li class="field"> <label for="photo" class="required " ><?php echo $this->__('Photo') ?></label> <div class="required-entry input-text"> <input type="file" name="photo" id="photo" value="<?php echo $this->htmlEscape($this->getCustomer()->getPhoto()) ?>" title="<?php ech

How to check an already existing record in Magento?

I am trying to perform an SQL query kind of thing where I need to check if my database table contains a particular record or not. If it does, do nothing else add the record which isn't present. My table sample contains fields like sample_id (auto-incremented), order_id, order_email_id, review_request, coupon_sent . It has got 4 records having order_ids (71, 74, 126, 165) To obtain $ids, I have this query, $to_date = date('Y-m-d H:i:s',strtotime('-3 days')); $orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('status', 'complete')->addFieldToFilter('updated_at',array('to' => $to_date ))->addAttributeToSelect('customer_email')->addAttributeToSelect('entity_id'); foreach($orders as $order) { $email = $order->getCustomerEmail(); $id = $order->getEntityId(); $sample = Mage::getModel('sample/sample')->getCollection()->addFieldToFilter('orde

Magento Best Way to Call Modalbox After Item is Added to Cart

I'm looking for a way to call a Modalbox (http://okonet.ru/projects/modalbox/index.html) after a customer has added an item to a cart... How do you call a Modalbox from within php? I was thinking of calling the modalbox after the success message in the CartController.php, however, I don't know how to do this from PHP, only from an HTML link with OnClick.