magento remove sku number (unit) from transactionnal email - magento-1.7

I am using magento 1.7.0.2. I have tried to remove sku from the transactional email when order is placed. After lot of r & d I got the solution. I removed the "<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Sku') ?></th>" line from "app\design\frontend\base\default\template\email\order\items.phtml" and also removed "<td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $this->htmlEscape($this->getSku($_item)) ?></td>" from "app\design\frontend\base\default\template\email\order\items\order\default.phtml" but nothing helped. Just able to remove sku column from header from the items.phtml file. I come to know to conclusion that the rows for the items generated are from items.phtml & these are -
<?php $i=0; foreach ($_order->getAllItems() as $_item): ?>
<?php if($_item->getParentItem()) continue; else $i++; ?>
<tbody<?php echo $i%2 ? ' bgcolor="#F6F6F6"' : '' ?>>
<?php echo $this->getItemHtml($_item) ?>
</tbody>
<?php endforeach; ?>
only "echo $this->getItemHtml($_item)" this line is responcible to print all the columns. I’ve tried tracking the getItemHtml call back through all the code but still haven’t a clue where the actual table html gets generated from. Does anyone have clue?
Any help is appreciated.Thanks.

I have already added one additional column in transactional emails. The files mentioned by you is correct. I think you have done in base/default folder. If you have used any themes, then change the same in the path app/design/frontend/default/yourThemeName/template.

Related

Date format in a function WordPress ACF

I have asked a similar question in the past but still have issues...
I am therefore placing the whole function here.
Can anyone tell me how to change the format that the date is output?
Currently it shows 20130731
I want it to show 31st July 2013
function le_detail() {
?>
<div class="event">
<!--Standard WP - use 'echo' -->
<h2 class="button"> <?php echo get_the_title(); ?> </h2>
<!-- ACF - NO 'echo' -->
<h3><?php the_field('where'); ?></h3>
<h3><?php the_field('when'); ?></h3>
<p><?php the_field('description'); ?></p>
<p>Chairman: <?php the_field('chairman'); ?></p>
</div>
<?php
}
The date is the line: (this is using the Advanced Customs Fields plugin)
<h3><?php the_field('when'); ?></h3>
Yes, I had this same problem until I tried it this way:
$date = DateTime::createFromFormat('Ymd', get_field('my_datefield'));
//use your field name
then...
<li>Ticket Date: <?php echo $date->format('d M, Y'); ?> </li>
Good Luck!
ACF plugin is having get_field('') function to get the value of the custom field. Since you have used 'when' as the field name, so do as follows:
<h3><?php echo date("dS F,Y",strtotime(get_field('when'))); ?></h3>
Use the above code snippet, that will solve your problem.

form submission not always working

I'm trying to figure out the problem here and I can't see why its not working. I've got an edit form that 99% of the time submits fine but for some records it doesn't. This is some of the code on the form:
<?php echo form_open('administration/categories/edit_offer_content_success')?>
<table cellpadding="6" cellspacing="0" class="admin-panel table_style">
<tr>
<th><b>Edit Offer</b><?php echo form_hidden('id',$offer->id)?></th>
</tr>
<tr>
<td>Name:<br /><?php echo form_input(array('name' => 'name', 'value' => $offer->name, 'size' => '100'))?></td>
</tr>
<tr>
<td align="center" valign="middle" height="20"><?php echo form_submit('','Save')?></td>
</tr>
</table>
<?php echo form_close()?>
When you click on the save button it should go to the edit_offer_contents function but on some records, it goes to the index page of the site instead. I remmed out all the code in this function and set it to load a debug page instead hoping to track down where the error was occurring, but on the records that won't save, it still goes to the index page of the site so it looks like its not getting to the function but I can't see why. There is no validation as far as I can see and I'm now banging my head against the wall
function edit_offer_content_success()
{
$this->output->enable_profiler(TRUE);
$this->load->view('admin/debug');
// redirect ('administration/categories/edit_offer/'.$id,'refresh');
}
if anyone has any ideas I'd be very grateful
i suppose you have one of the columns set as unique key in the database and sometimes trying to update the values of those columns to some existing values.

How can I dynamically create multiple checkboxes with Zend Form?

Could you please help me to solve my problem?
I would like to place a checkbox on every row of a list of users built with database information and add a validation button to post my form. My list should look something like this:-
So the user will select the checkbox linked to the student he wants to validate.
The number of rows of the result is variable, so i don't know how to do it.
I hope i've been clear in my description.
You haven't shown any code, but I am assuming that you get the number of students somewhere in your controller.
To achieve what you want with Zend_Form, you will need to render each element individually, but first you need to find a way of adding the correct number of elements to your form.
Preferably, you would do this in your form class to keep the logic out of the controller, but to keep this answer simple I will show you how to achieve this in your controller, you can then adapt the code as you wish.
$numStudents = getNumberOfStudentsSomehow();
$studentForm = new yourFormClass();
for($i = 0; $i <= $numStudents; $i++){
$checkBoxes[] = new Zend_Form_Element_Checkbox('checkBox_' . $i);
}
$studentForm->addElements($checkBoxes);
$this->view->studentForm = $studentForm;
Your form now has the correct number of check boxes in it and you can pass it to the view.
In the view you have several options for rendering the form, either a view partial as suggested by RockyFord, a view helper (documentation here), create a custom view script for your form, or render directly in your view.
To get you started you can render individual elements from your form in your view like this:-
echo $this->view->studentForm->checkBox_0;
I think this might be a situation were a partialLoop() might be the best solution.
in your controller get your data from the model as usual and assign it the data to the view
$this->view->modelData= $data;
next make a new .phtml file in /views/scripts for this demo we'll call it _demoRow.phtml then code the html and php for one table row (in this case).
<tr>
<td><?php echo $this->name ?></td>
<td><?php echo $this->class ?></td>
<td><?php echo $this->birth_date ?></td>
<td><input type="checkbox" name="id" value="<?php echo $this->id ?> /></td>
</tr>
Then in your normal view just put the static information and render the partial
<form action="/your/action/url" method="post">
<table class="spreadsheet" cellspacing="0">
<tr>
<th>Student Name</th>
<th>Class</th>
<th>Birth Date</th>
<th>Select</th>
</tr>
<?php echo $this->partialLoop('_demoRow.phtml', $this->modelData) ?>
<tr>
<input type="submit" name="submit" value="valider" />
</tr>
</table>
</form>
This should approximate what you're looking.

How to Spread formwidgets in doctrine into multiple columns?

I'm using symfony1.4 with doctrine. I'm able to insert/update/delete records using form widgets. But the problem is i have some 75 fields in a single form which i want to spread into two columns.Please tell me a way to implement this please.....
This can be done by rendering each one individually on your template or view... For example, if your form has a widget called name, in your template of partial, you can render it by doing:
//this will render the row as the assigned formater does
<?php echo $form['name']->renderRow()?>
or
//in a table
<tr>
<td>
<!-- will output only the label -->
<?php echo $form['name']->renderLabel()?>
</td>
<td>
<!-- will output only the 'input' -->
<?php echo $form['name']->render()?>
<!-- will output only the error messages -->
<?php echo $form['name']->renderError()?>
</td>
</tr>
If you have any doubt check the Symfony's Forms for Web Designers for more details.

porting template to zend framework

I got few issues proting a pear based form to zend form.
I have few elements I need :
Basic Elements
Groups
Group Elements
Sections
I previously used templates to render the forms on Pear. I obviously cannot use pre-existing zend decorators, since I need to specify css classes for each of the components of my base elements.
To see the issue I need to render this, which is the template for a basic element :
<li class = "{position_in_the_form} {error}">
<label class="{label_class}"> {label}
[<span class="required_class"> * </span>]
</label>
<div> {element_content} </div>
[<p class = "{error_class}"> {error_message} </p>]
</li>
So as you can see I have many dynamic things I would like to be able to specify : position in the form, class for the label, class for the required section, the class for the error.
I would also like to be able to specify this from an ini file. I manage to set up the basic meta from the ini but not custom fields.
One of the reason I cannot use basic decorators is that I need to have "error" in the "li" class when there is an error in the element or the sub_form.I'm not sure this is possible with the error decorator... (correct me if I'm wrong)
Also, for the group I need something handling the errors, and since the core groups don't handle errors I need to subclass the sub_form. But how can I create a subform in an ini file and I don't know how to provide parameters to the sub form fromn the ini.
The main idea here is to be able to have visual and logic groups of elements in a form. For example I need a 'name' group with fullname, middle name, etc. This also implies a global validator for this "name" group.
An other thing is that I want to be able to position these groups : left half, right half, full
I got the css ready for this and working with pear.
So what I need is a simple solution, with few code and ini configurations. Unfortunately I think I got stuck in something too complicated, so if someone has any idea about a simple architecture it would be amazing!
Thanks in advance for your help,
Best, Boris
In your complex decoration need, you might want to use the ViewScript Zend_Form_Element_Decorator
$element->setDecorators(array(
array('ViewScript', array('viewScript' => 'path/to/your/views/element.phtml')),
));
and then in path/to/your/views/element.phtml, more or less something like
<li class="<?php echo $this->element->getAttrib('position_in_the_form') ?> <?php echo $this->element->hasErrors() ? 'error' : '' ?>">
<label class="<?php echo $this->element->getAttrib('label_class') ?>">
<?php echo $this->formLabel($this->element->getName(),
$this->element->getLabel()) ?>
<? if ( $this->element->isRequired() ) { ?>
[<span class="required_class"> * </span>]
<? } ?>
</label>
<div> <?php echo $this->{$this->element->helper}(
$this->element->getName(),
$this->element->getValue(),
$this->element->getAttribs()
) ?> </div>
<? if ( $this->element->hasErrors() ) { ?>
[<p class="<?php echo $this->element->getAttrib('error_class') ?>"> <?php echo $this->formErrors($this->element->getMessages()) ?> </p>]
<? } ?>
</li>
This is only a drafty snippet of code, but should lead you in the direction you aim.
Regards