Problems, need help? Have a tip or advice? Post it here.
9 posts Page 1 of 1
I have this scenario: Order-now page and Reedem-deal page. They are both the same, except that reedem deal page has some fields that the order-now page doesn't.

I would need this functionality:
1.Order-now page normally checks out with PayPal
2. Reedem deal, I would like to show the summary of the cart on the checkout page and have a submit button that collects the info from the cart and sends it given email address.

I can easily have this done with a help of a custom checkout template KK provided here in one of the previous threads.

So this is what I need: Order-now page = normal checkout and Reedem-deal page = custom checkout

Is this behaviour possible?
Is this behaviour possible?

Make the two links point to two different templates - make one template redirect to PayPal while making the other use email. Any problems with this approach?
Yes, I was thinking the same, but I am not sure where do I change the links to templates.

They are both submitted upon clicking on buy now button, that is wrapped inside couch product form.

Code: Select all
<cms:pp_product_form class="cart-form">
<p style="text-align:center;"><input class="btn-cta big" type="submit" value="Buy Now &euro;100"></p>
</cms:pp_product_form>
Is adding a action attribute to the form all that I need to do?

edit: I just tried that, it doesn't work, it is hardcoded value I am afraid :(
It just goes to cart.php, of course as it is the defualt behaviour.

Can I specify two different templates in the config file :D ?
The problem in your case is that the 'Order-now' page and 'Reedem-deal' page are both selling the same product. Adding the product from any of the two leads to the common cart.php page (that also shows the PayPal checkout button).

It is in the cart.php page that we somehow need to figure out the page used to access it.

One way of doing this could be the following -
The cms:pp_product_form by default redirects to the cart page after adding a product.
It, however, supports a 'redirect' parameter to make it redirect to a page of our choice.
We can use this property to make the tag on 'redeem' page redirect to the cart page but with an additional querystring parameter in its URL that would tell us that it was invoked from the redeem page.

Modify your code to add the highlighted part to it -
<cms:pp_product_form redirect="<cms:pp_cart_link />?redeem=1" class="cart-form">

Now on the cart template we can test if we are coming from the 'redeem' page or not and accordingly display the email-form or the PayPal button -
Code: Select all
<cms:if "<cms:gpc 'redeem' method='get' />" >
    .. show email form ..
<cms:else />
    .. show PayPal checkout ..
</cms:if>

Hope this helps.
Thanks KK! It works like a charm.

Basically the solution you provided is something similar to fragment identifiers, am I right?
I am already using them on this particular website, but not in Couch version, but the normal ones with #, they are great when you need to determine from which page someone has arrived on the current one, and then act accordingly.
Honestly, they first crossed my mind when I encountered this problem, but I didn't knew they can be implemented like this, with the redirect parameter.

Thanks, great support, as always :)
You are welcome, Mirko :)
As I already stated, everything works like a charm, except that I can't get the success message to display.

This is the code, the email arrives perfectly, but there is no success message shown:
Code: Select all
 <cms:form method="post" anchor='0'>
               
                <cms:if k_success >
                    <cms:set email_from='sales@me.com' />   
                    <cms:set email_bcc='me@me.com' />   
                    <cms:set email_subject='Reedem Deal order' />
                    <cms:set email_debug='1' />   
                   
                    <cms:embed 'sales_email.html' />   

        <cms:set_flash name='order_complete_msg' value="<cms:embed   'sales_success_msg.html' />"/>
                   
                    <cms:pp_empty_cart />
                    <cms:redirect k_page_link />
                </cms:if>
               
                <cms:if k_error >
                    <div class="error" style="color:red;">
                        <ul>
                        <cms:each k_error >
                            <li><cms:show item /></li>
                        </cms:each>
                        </ul>
                    </div>
                </cms:if>   
               
<cms:input name="place_order"  class="checkout-button" type="submit" value="Place Order" />
               
            </cms:form>


sales_success_msg.html is placed in the snippets folder.
To answer my previous question, I got it working by using the redirect parameter, thus sending the user to a new success page.

Although, if someone knows, I would like to know how to get the embedded success message to work :)
9 posts Page 1 of 1
cron