how to show different effects in nivoslider dynamically - nivo-slider

i am using nivoslider and have 4 different slides and for each slide i want different effect as slideInLeft,fade,fold and sliceUpDown for each different one. my slider is running well,it's just i needed different sliding effect for each slides.i am using codeigniter. any help/suggestions are welcome.thanks
<img src="uploaded_files/banner/<?php echo $banner->file ?>" data-thumb="uploaded_files/banner/<?php echo $banner->file ?>" alt="" data-transition="slideInLeft"/>
<script type="text/javascript">
$(window).load(function() {
$('#slider').nivoSlider();
});
</script>

it is simple.i just to have to add some conditions as follows.
$i = 1;
if($i=='1') $transition = 'slideInLeft';
elseif($i=='2') $transition='fade';
elseif($i=='3') $transition='fold';
else $transition = 'sliceUpDown';
?>
<img src="uploaded_files/banner/<?php echo $banner->file ?>" data-thumb="uploaded_files/banner/<?php echo $banner->file ?>" alt="" data-transition="<?php echo $transition?>"/>
$i++;
it worked but if someone has some better idea than this one,please do share.

Related

two or more views in one layout (cakephp)

Is it possible to add two or more views in one layout in cakephp 2.x?
What you might need are elements: http://book.cakephp.org/2.0/en/views.html#elements
you can put all info data in one element and then include it wherever you want.
view:
<div class="info">
<h2><?php echo __('Info'); ?></h2>
<?php echo $this->Element('info'); ?>
</div>
view/elements/info.ctp:
<?php echo 'Hello world'; ?>

How to display content from a child page within a hierarchial custom post type?

I have a hierarchical custom post type. It has 6 pages, and each page has 3 child pages.
When viewing one of the 6 pages, I need to display content (a title and excerpt) from each of its 3 child/descendent pages.
Here is my current loop:
<?php if(have_posts()):?>
<?php query_posts('&post_type=how-we-do-it&post_parent=0');?>
<?php while(have_posts()):the_post();?>
<?php $color = get_post_meta( get_the_ID(), 'pointb_how-we-do-it-color', true ); ?>
<div class="section">
<div class="title">
<h1 style="background:<?php echo $color;?> !important;">
<?php the_title();?>
</h1>
</div>
<div class="content">
<div class="how-<?php the_slug();?>">the summary here. and here is child content:
<div class="child">child content should be here.</div>
</div>
</div>
</div>
<?php endwhile;?>
<?php wp_reset_query(); ?>
<?php endif;?>
I have tried numerous different approaches to try and accomplish what I need, but none of them work within the custom post type. Here are some of the various methods I have tried:
I tried the suggested code on this page: http://wordpress.org/support/topic/display-child-pages-title-amp-content-on-parent-page
I also tried the following code:
$pageChildren = get_pages('child_of='.$post->ID');
if ( $pageChildren ) {
foreach ( $pageChildren as $pageChild ) {
echo '<h2>'. $pageChild->post_title.'</h2>
';
if ($pageChild->post_excerpt){
echo ''.$pageChild->post_excerpt.'
';
}
}
}
I've tried a number of other methods that I didn't bother saving, so I can't show them.
I'm at the point where I am getting frustrated with this and thought I'd throw it out here to get some fresh perspectives.
The issue with your first sample is that you call if(have_posts()) before you reconstruct the query.
The second sample has a dangling ' after $post->ID.
Try this:
$pageChildren = get_posts( 'post_type=how-we-do-it&post_parent='.$post->ID );
Based on some comments from MarZab above, I got thinking about the post ID.
I made the following tweak to the block of code I originally posted above, and now it works perfectly:
$pageChildren = get_pages('child_of='.$post->ID');
Is now:
$post_id = get_the_ID();
$pageChildren = get_posts( 'post_type=how-we-do-it&echo=0&post_parent='.$post_id );

What is the link to redirect after successful payment at payment gateway in opencart?

I've implemented payment module in Opencart based on BankTransfer module.
Requirement for payment gateway is to submit with get request a successurl and errorurl. Those URL are for successful order and canceled order.
Algorithm:
Customer gets to the order checkout.
Click confirm order
Gets redirected to localhost/opencart/testkzm.php, where values are printed out and there's a link with to which i should redirect in case of success.
QUESTION: What is the link to redirect after successful payment at payment gateway?
Approach:
I've naively thought that http://example.com/opencart/index.php?route=checkout/success is the success link. It's only shows confirmation message, but order is not placed in the system. I understand that there's no way to give external link that will automatically know which order to confirm, so should i pass encrypted unique values in successurl, so on return i can decrypt them and confirm order?
Explanation of files:
banktransfer.php is file opencart gets information from system such
order id, amount of the order and etc.
banktransfer.tpl is template
file for rendering page in browser.(Actual front-end)
testkzm.php is
simple file that i wrote to test that i get correct values from
system.
testkzm.php is
simple file that i wrote to test that i get correct values from
system.
banktransfer.php in controller/payment
class ControllerPaymentBankTransfer extends Controller {
protected function index() {
$this->language->load('payment/bank_transfer');
$this->data['text_instruction'] = $this->language->get('text_instruction');
$this->data['text_description'] = $this->language->get('text_description');
$this->data['text_payment'] = $this->language->get('text_payment');
//Modified things for KZM
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
$this->data['orderIdKZM'] = $this->session->data['order_id'];
$this->data['amountKZM'] = $order_info['total'];
$this->data['merchantIdKZM'] = $this->language->get('merchantIdKZM');
$this->data['currencyKZM'] = $this->language->get('currencyKZM');
$this->data['titleKZM'] = $this->language->get('titleKZM');
$this->data['successuUlKZM'] = $this->language->get('successUrlKZM');
$this->data['errorUrlKZM'] = $this->language->get('errorUrlKZM');
$this->data['dateKZM'] = $this->language->get('dateKZM');
$this->data['signstrKZM'] = $this->language->get('signstrKZM');
$this->data['verKZM'] = $this->language->get('verKZM');
//KZM
$this->data['button_confirm'] = $this->language->get('button_confirm');
$this->data['bank'] = nl2br($this->config->get('bank_transfer_bank_' . $this->config->get('config_language_id')));
$this->data['continue'] = $this->url->link('checkout/success');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/bank_transfer.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/bank_transfer.tpl';
} else {
$this->template = 'default/template/payment/bank_transfer.tpl';
}
$this->render();
}
public function confirm() {
$this->language->load('payment/bank_transfer');
$this->load->model('checkout/order');
$comment = $this->language->get('text_instruction') . "\n\n";
$comment .= $this->config->get('bank_transfer_bank_' . $this->config->get('config_language_id')) . "\n\n";
$comment .= $this->language->get('text_payment');
$this->model_checkout_order->confirm($this->session->data['order_id'], $this->config->get('bank_transfer_order_status_id'), $comment, true);
}
}
banktransfer.tpl
<h2><?php echo $text_instruction; ?></h2>
<div class="content">
<p><?php echo $text_description; ?></p>
<p><?php echo $bank; ?></p>
<p><?php echo $text_payment; ?></p>
<p><?php echo $orderIdKZM; ?></p>
<p>
<?php
$titleKZM = $titleKZM.$orderIdKZM;
$merchantIdKZM = '23';
$currencyKZM = 'KZT';
$successUrlKZM = '';
$erroUrlKZM = '';
$dateKZM = $merchantIdKZM.$orderIdKZM.$amountKZM.$currencyKZM;
?></p>
</div>
<div class="buttons">
<div class="right">
<form action="http://example.com/opencart/testkzm.php" method="get">
<input type="hidden" name="merchantIdKZM" value="<?php echo $merchantIdKZM; ?>">
<input type="hidden" name="orderIdKZM" value="<?php echo $orderIdKZM; ?>">
<input type="hidden" name="amountKZM" value="<?php echo $amountKZM; ?>">
<input type="hidden" name="currencyKZM" value="<?php echo $currencyKZM; ?>">
<input type="hidden" name="successUrlKZM" value="<?php echo $successUrlKZM; ?>">
<input type="hidden" name="errorUrlKZM" value="<?php echo $errorUrlKZM; ?>">
<input type="hidden" name="signstrKZM" value="<?php echo $signstrKZM; ?>">
<input type="hidden" name="verKZM" value="<?php echo $verKZM; ?>">
<input type="button" value="<?php echo $button_confirm; ?>" id="button-confirm" class="button" />
</form>
</div>
</div>
<script type="text/javascript"><!--
$('#button-confirm-s').bind('click', function() {
$.ajax({
type: 'get',
url: 'index.php?route=payment/bank_transfer/confirm',
success: function() {
location = '<?php echo $continue; ?>';
}
});
});
//--></script
testkzm.php
merchantID <?php echo $_GET["merchantIdKZM"]; ?><br>
orderID <?php echo $_GET["orderIdKZM"]; ?> <br>
amount <?php echo $_GET["amountKZM"]; ?><br>
currency <?php echo $_GET["currencyKZM"]; ?> <br>
successURL <?php echo $_GET["successUrlKZM"]; ?><br>
errorURL <?php echo $_GET["errorUrlKZM"]; ?> <br>
signstr <?php echo $_GET["signstrKZM"]; ?><br>
ver <?php echo $_GET["verKZM"]; ?> <br>
<div class="buttons">
<div class="right">
asdfas
</div>
</div>
The return URL from the payment gateway is completely up to yourself and the payment gateway's methodology. In general, if you can pass a url to the payment gateway to return for true and/or false for the success of the transaction, you would get it to use a method of your payment gateways controller, such as http://yourstore.com/index.php?route=payment/payment_gateway/success where you can then process the payment, and update the order status accordingly
If you want to then go to the checkout success page, you would use $this->redirect($this->url->link('checkout/success', '', 'SSL')). If it fails, you should redirect back to the checkout pages where the customer can quickly skip through the various pages which should already have their details filled in, and they can then try again
The success url is checkout/success as you thought.
The payment module should confirm the payment before goes to success page. Bank Transfer module do the confirmation by using AJAX (as you can see in banktransfer.tpl) to calls confirm function in banktransfer.php.
It's better if you use another payment gateway module (like pp_standard, moneybookers, paymate, etc) as your starting point instead Bank Transfer because they are more resemble with your custom payment gateway module requirements.
I made this just added simple redirect code to start
<?php
header('Location:http://yoursite location');
exit;
?>
in view/template/yourtemplate/common/success.tpl

Masonry Infinite Scroll with Database and Anchor Tag that links to the current document

I am new to PHP, Javascript and HTML. So maybe I'm missing something obvious but, I can't for the life of me figure out what is wrong with my code. I am trying to use Paul Irish's Infinite Scroll with a PHP file that has an anchor point that links back to itself with different GET values. The problem is that Anything I do gives me this error:
Sorry, we couldn't parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag.
I am at my wits end and desperately need someones help because I need this done by January 20th. It's going to be a birthday gift for someone I know.
Here is my code:
index.php (Code Snippet)
<div id="content-container" class="container-fluid" style="padding:0px;overflow:hidden;">
<div class="row-fluid full">
<div class="span12 full" style="overflow:scroll;position:relative;">
<div id="media-palette">
<?php
include('content.php');
?>
</div>
</div>
</div>
</div>
script.js (Code Snippet)
$("#media-palette").infinitescroll({
navSelector:"#next",
nextSelector:"#media-palette a#next:last",
itemSelector:".media-content",
bufferPx:50,
debug: true,
}, function(newElements) {
$("#media-palette").masonry('append', newElements,true);
});
content.php
(It is worth noting that the images found in this file are for testing purposes and the final PHP file will load images from a database.)
<?php
require('dbconnect.php');
$startIndex = $_GET['start'];
$endIndex = $_GET['end'];
$nextStartIndex = $endIndex-1;
$nextEndIndex = $endIndex-10;
?>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<?php
$files = scandir("images");
if ($files) {
$length = count($files);
static $allowedExts = array("jpg", "jpeg", "gif", "png");
for ($i = 0; $i < $length; $i++) {
$extension = end(explode(".", $files[$i]));
$extension = strtolower($extension);
if (in_array($extension,$allowedExts)) {
$rand = rand(0,10);
if (!$rand) echo "<img class='media-content medium' src='images/".$files[$i]."'/>";
else echo "<img class='media-content small' src='images/".$files[$i]."'/>";
}
}
}
echo '<a id="next" href="content.php?start='.$nextStartIndex.'&end='.$nextEndIndex.'"></a>';
?>
</body>

Hiding some configurable attribute in the front-end - magento

Please help...anyone
I have a problem with hiding some configurable attributes:
These are my configurable attributes at the back-end:
Shape/Type
Grit & Colour
Shank
Items pack
Diameter
Supplier
My client wants to hide the "Manufacturer" attribute on the front-end
but wants to import the supplier at the back-end.
Please see the website I am working:
http://ridental.com.au/newsite/polishers.html/
I managed to hide it from front-end by just adding some if statement
like this: in the app\design\frontend\default\MYTEMPLATE\template\catalog\product\view\type\options\configurable.phtml
<?php
$_product = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
<dl class="outer">
<dl class="inner">
<?php foreach($_attributes as $_attribute): ?>
<?php $attCode = $_attribute->getProductAttribute()->getFrontend()->getAttribute()->getAttributeCode(); ?>
<?php if($attCode != "manufacturer"):?>
<div class="dtdd-wrapper<?php if ($_attribute->decoratedIsLast){echo " last";}?>">
<dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt>
<dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
<div class="input-box">
<select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
<option><?php echo $this->__('Choose an Option...') ?></option>
</select>
</div>
</dd>
</div>
<?php endif; ?>
<?php endforeach; ?>
</dl>
</dl>
<script type="text/javascript">
[b]var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);[/b]
</script>
The Manufacturer will not be displayed on the front-end.
But when I click Add to Cart button I got the error:
Please specify the product's option(s).
I noticed that in:
var spConfig = new Product.Config(<?php echo $this->getJsonConfig()
It is still referring to the attribute "supplier" and waiting for the user response to choose Manufacturer in the drop down.
that's why I get the error: Please specify the product's option(s).
My question:
Is it possible to filter the function getJsonConfig()?
let say not include the:
if ($attributecode != 'manufacturer'){
do some stuff.....
}
I copied a local version of this function and now found in: app\code\local\Mage\Catalog\Block\Product\View\Type\Configurable.php
Please help...if anyone accomplished this kind of problem.
I tried extending getJsonConfig() to filter some attribute like "supplier" but to no avail.
Am I doing the right thing?
Chances are, from what you are describing, you should remake the configurable product without using the "Supplier" attribute.
When you make a configurable product, the first screen that allows you to mark attributes with check boxes is meant to define what the configurable product will be filtering, the attributes will still be attached to the product information.

Resources