Magento Checkout Methods list - magento-1.4

Is there a way to see the methods lists that is being called in the shopping cart view.
<ul class="checkout-types">
<?php foreach ($this->getMethods('methods') as $method): ?>
<?php if ($methodHtml = $this->getMethodHtml($method)): ?>
<li><?php echo $methodHtml; ?></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
This code is in the views anywhere the "Proceed to Checkout" button shows up but my Paypal Express button isn't in the list. I can trace it back to the Block abstract but then the code looses me (ie what calls setChild to make 'methods' a child and to give it a block?).

Related

How to i get Events previous and next Event in contao detail page and list page ? f.e < Previous Event | Current Event ( id - 4) | Next Event >

How to i get Events previous and next Event in contao detail page and list page ? f.e < Previous Event | Current Event ( id - 4) | Next Event
Blockquote
There is no extension for Contao 3 that I know of. However, you could do the following.
Insert the following PHP code at the top of your event_full template:
<?php
$this->getEventUrl = function($objEvent)
{
global $objPage;
return \Controller::generateFrontendUrl($objPage->row(), '/' . $objEvent->alias, null, true );
};
$objNextEvent = \CalendarEventsModel::findOneBy(
array("startDate > ?", "published = '1'", "pid = ?"),
array($this->startDate, $this->pid),
array('order' => 'startDate ASC'));
$objPreviousEvent = \CalendarEventsModel::findOneBy(
array("startDate < ?", "published = '1'", "pid = ?"),
array($this->startDate, $this->pid),
array('order' => 'startDate DESC'));
?>
This will try to fetch the previous and next event in the most simple way.
Insert the following somewhere in your event_full template (e.g. before the last closing </div>:
<?php if ($objPreviousEvent || $objNextEvent): ?>
<div class="pagination">
<?php if ($objPreviousEvent): ?>
<div class="prev">
<a href="<?= $this->getEventUrl( $objPreviousEvent ) ?>" title="<?= $objPreviousEvent->title ?>">
« <?= $objPreviousEvent->title ?>
</a>
</div>
<?php endif ?>
<?php if ($objNextEvent): ?>
<div class="next">
<a href="<?= $this->getEventUrl( $objNextEvent ) ?>" title="<?= $objNextEvent->title ?>">
<?= $objNextEvent->title ?> »
</a>
</div>
<?php endif ?>
</div>
<?php endif ?>
This will echo the URLs to the previous and next events within some HTML code.
There are some drawbacks:
the code above does not consider the start and end fields
this will only show the previous and next event of the same calendar (otherwise the target URL might be wrong)
this will only work with an enabled auto_item parameter
Update: I have created a Github Gist here: https://gist.github.com/fritzmg/aa4632be2231d77e7d6ec0e5e0a854ae

How to Display Wordpress Posts by Custom Field

I am trying to create a page that displays all my wordpress posts that contain a certain custom field. I assumed that the best way to do this is to create a "custom page template" and use a new WP_query to list the posts in question. I created a new "page" and applied the new "page template" with my new WP_query, however no posts show up on the page. Can anyone tell me why this custom page template does not correctly list the posts in question? Any help is much appreciated!
<?php
/**
* Template Name: Recommended Incentives
*
* #package WordPress
* #subpackage Twenty_Fourteen
* #since Twenty Fourteen 1.0
*/
get_header(); ?>
<div id="main-content" class="main-content">
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php
// args
$args = array(
'meta_key' => 'Incentive ID',
'meta_value' => '20'
);
// get results
$the_query = new WP_Query( $args );
// The Loop
?>
<?php if( $the_query->have_posts() ): ?>
<ul>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<li>
<?php the_title(); ?>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>
</div><!-- #content -->
</div><!-- #primary -->
</div><!-- #main-content -->
<?php
get_sidebar();
get_footer();
Thanks Andy,
My code worked when I specified the post type in the $args variable. The code I used is
'meta_key' => 'Incentive ID',
'meta_value' => array(20,21),
'orderby' => 'meta_value_num',
'order' => 'ASC',
'post_type' => 'incentives'

Symfony Admin generator: transform batch actions from select list to links

in the objects list generated with the admin generator, the batch Action are shown in a select with a submit button.
I want to transform it and get only link (for example i have the action delete and i want to have a link to delete instead of choosingthe action and than click on the button.)
i have the _list_batch_actions.php file but i could'nt see how to get the href for the tag:
<li class="sf_admin_batch_actions_choice">
test // this is what i added but not woorking
<select name="batch_action">
<option value=""><?php echo __('Choose an action', array(), 'sf_admin') ?></option>
<option value="batchDelete"><?php echo __('Delete', array(), 'sf_admin') ?></option>
</select>
<?php $form = new BaseForm(); if ($form->isCSRFProtected()): ?>
<input type="hidden" name="<?php echo $form->getCSRFFieldName() ?>" value="<?php echo $form->getCSRFToken() ?>" />
<?php endif; ?>
<input type="submit" value="<?php echo __('go', array(), 'sf_admin') ?>" />
</li>
Any idea on how i can use it ?
Solution one:
The batch actions are submitted by form by default. You can rewrite the template to put links instead of a form.
Check your auto generated controler in the cache
(you need before to see your admin page in order to generate the cache).
apps/backend/dev/modules/autoYourModule/actions/action.class.php
You will find a function executeBatch().
You can copy this function and put it in your admin module controler and then modify its behaviour in order to do what you need.
Solution two:
Use javascript to hide your form and put a link which will select the delete action in your select box, the submit the form using javascript.

sfWidgetFormDoctrineChoice: how to iterate data from nested models? (Symfony 1.4)

I have the ConnectForm with nested fields from other model: Numbers.
I want to render this ConnectForm with all Numbers and everything works well when i just
<?php echo $form['numbers_list'] ?>
But i need to print other Numberss' fields like: price, code etc.
How to print it?
The best way for me would something like this:
<?php foreach($form['numbers_list'] as $num): ?>
<span> echo $num->renderInput()</span>
<span>echo $num->getPrice()</span>
<span>echo $num->getCode()</span>
<?php endforeach; ?>
You probably are better off creating a custom sfWidgetFormSchemaFormatter class and then using that to output your form - you can output a whole form once you have created your new sfWidgetFormSchemaFormatter class by doing <?php echo $form ?> for example :
class sfWidgetFormSchemaFormatterCustom extends sfWidgetFormSchemaFormatter
{
protected
$rowFormat = "<span class=\"my-label-class\">%label%</span>\n <span>%error%%field%%help%%hidden_fields%</span>`n",
$errorRowFormat = "<span class=\"my-error-class\" colspan=\"2\">\n%errors%</span>\n",
$helpFormat = '<br />%help%',
$decoratorFormat = "<div>\n %content%</div>";
}
Then within the configure method of your form add the following that tells the form to use your custom decorator :
$this->getWidgetSchema()->setFormFormatterName('custom');

Magento Move attributes.phtml

i need to remove short description in the view.phtml and replace with attribute.phtml tab...how to do it? Thanks.
Edit your theme's template/catalog/product/view.phtml (not the base theme's, that can get overwritten) and replace this:
<?php if ($_product->getShortDescription()):?>
<div class="short-description">
<h2><?php echo $this->__('Quick Overview') ?></h2>
<div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>
</div>
<?php endif;?>
with this:
<?php echo $this->getChildHtml('additional') ?>
And further down where you see the same line delete it. This avoids duplication.

Resources