WordPress.org

Ready to get started?Download WordPress

Forums

Simple Cart & Buy Now
[resolved] Email a Cart (15 posts)

  1. mattbaylor
    Member
    Posted 1 year ago #

    Is there an easy way to email the cart and it's contents to a pre-specified email address? Thanks!

    http://wordpress.org/extend/plugins/simple-cart-buy-now/

  2. bluey80
    Member
    Plugin Author

    Posted 1 year ago #

    Take a look at

    templates/default/process.php

    you'll want to copy that file (and edit the copied file) into templates/yourtemplate/process.php and configure SCABN to use the template yourtemplate.

    Instead of running at the of the process.php

    $output .= scabn_make_paypal_button($options,$holditems);
    $output .= scabn_make_google_button($options,getShippingOptions($holditems),$holditems);

    you'll want something like

    $output .= scabn_send_email($options,$holditems);

    where scabn_send_email is a function you will write. You can look at the scabn_make_paypal_button function as a reference. It is located in includes/functions.php

    You'll have to lookup using php to send email as SCABN doesn't current do that.

  3. songjihyo
    Member
    Posted 1 year ago #

    Hello I'm having the same issues, I've managed to make a function and lead it to a a send-cart.php to send the email but I can't seem to include the cart information into the email.

    Could you kindly guide me?

    I tried storing the orderlist into a session in functions.php and then calling it at shoppingcart.php and send-cart.php but the data won't load.

    I can't seem to find the answers on the internet so if you could kindly guide me. thank you so much

  4. bluey80
    Member
    Plugin Author

    Posted 1 year ago #

    The variable $holditems is an array with the contents of the shopping cart. Each items in the array is a dictionary using the keys 'options', 'name', 'currency','qty' and 'price'. If you look at functions.php

    you can look at the function scabn_make_google_button($options,$shipoptions,$items) In it, it iterates over the items in the cart and gets their content:

    foreach($items as $item) {
    		$gc .= "\n\t\t<item>";
    		if ( $item['options']  ) {
    			$gc .= "\n\t\t\t<item-name>".$item['name']." (".scabn_item_options($item['options'],'--').")</item-name>";
    		} else {
    			$gc .= "\n\t\t\t<item-name>".$item['name']."</item-name>";
    		}
    		$gc .= "\n\t\t\t<item-description>".$item['name']."</item-description>";
    		$gc .= "\n\t\t\t<unit-price currency=\"".$options['currency']."\">".$item['price']."</unit-price>";
    		$gc .= "\n\t\t\t<quantity>".$item['qty']."</quantity>";
    		$gc .= "\n\t\t</item>";
    		}

    You can also look at the paypal function as well -- it does basically the same thing.

  5. songjihyo
    Member
    Posted 1 year ago #

    Hello again! I did base my function on the googlecheckout function and I can call it the cart on the shopping-cart.php page but I can't find a way to add it to the email php form where I also grab the rest of the data (like name, email etc) on the form that I added on the shopping-cart.php

    Is it possible to call the $holditems array into the send-cart.php form like in a session? Or am I getting the logic wrong / doing everything wrong? I'm sorry I'm kind of new to this

    thank you for responding so quickly!

    this is the function by the way, should I have added more here?

    function email_cart_button($options,$items) {
    	$currency = $options['currency'];
    	$ppo="<form method=\"post\" action=\"http://localhost/wordpress/wp-content/themes/client/send-cart.php\">\n";
    
    	foreach($items as $item) {
    		$orderlist .= "<p id=\"orderlist\">";
    		$orderlist .= $item['qty']." - ";
    		if ( $item['options']  ) {
    			$orderlist .= $item['name']." (".scabn_item_options($item['options'],'--').")";
    		} else {
    			$orderlist .= $item['name']." - ";
    		}
    		$orderlist .= $options['currency']." ".$item['price']." ";
    		$orderlist .= "</p></br>";
    		}
    	$ppo .= $orderlist."
    	<input type=\"submit\" name=\"submit\"
             value=\"Submit\" id=\"send-cart\" alt=\"Submit\"></form>";
    }

    I tried using sessions to call $orderlist to send-cart.php but it didn't work.

  6. songjihyo
    Member
    Posted 1 year ago #

    I think I just need a way to call the variables via $_POST? I can't seem to determine which name to call them as because they're dynamic. for example, i tried, $itemqty= $_POST['qty_'.$i]; but I can't grab the variable.

  7. bluey80
    Member
    Plugin Author

    Posted 1 year ago #

    You can't grab name / email information because we don't collect it. SCABN just builds a list of items to buy and then hands it off the Google Wallet / Paypal to get name, address, shipping method, payment, etc. There is no session, etc, as SCABN never handles any remotely sensitive information so the client (browser) can store the contents of the shopping cart and pass it SCABN to build a 'buy now' button when ready.

  8. helmutviet
    Member
    Posted 1 year ago #

    I want to add cart to email but i can't find the files that is mentioned

    Using Ver 2.0.1

  9. bluey80
    Member
    Plugin Author

    Posted 1 year ago #

    That is feature I'm hoping to add soon, but currently SCABN does not have the capability.

  10. Compvictor
    Member
    Posted 1 year ago #

    Hi, i'm interested in the same feature so i'll be reading and waiting for news.
    By now i'm using the plugin WP-email to let the customers send me the Checkout post via mail, so i receive an email with the prodducts he want and i can contact them (but they have to write down my email also :/).

    My site is http://www.kaiserwifi.com.ar, and the Checkout page is "Pedidos" (shows nothing if the cart is empty).

    This is a post I wrote asking about this feature: http://wordpress.org/support/topic/add-unique-recipient-to-wp-email?replies=1#post-4145906

    Thanks for your time bluey80

  11. bluey80
    Member
    Plugin Author

    Posted 1 year ago #

    Compvictor -- I think you will need to WP-email to include in the email the cart session data. My code accesses that data with lines like

    $cart =& $_SESSION['wfcart']; // load the cart from the session

    Then some $cart -> string / formatting function and append that to the email.

  12. Compvictor
    Member
    Posted 1 year ago #

    I think somehow WP-email is including the cart session, because i made several tests and i always receive the complete cart order.
    I'm new in php and coding so idon't know where or what functions add, for example, to clear the cart after sending the order, or don't ask the customer to fill in the recipient email.

    Remember this is a temporary solution for me until you can add the email feature to SCABN. I tried many complex shopping carts but all i want is to add a buy now button to the posts, a cart and a mail order, and your plugin served me well.

  13. wutrigy
    Member
    Posted 1 year ago #

    Hello

    This option would be really useful. Could you guide/make an example for us non-programmers what to do and change to make this work?

    We are trying to implement funcionality like this on ClassiPress. It would be most useful.

    Thanks

  14. bluey80
    Member
    Plugin Author

    Posted 1 year ago #

    Unfortunately, adding this feature is a real coding job, which is why it hasn't been implemented yet / there isn't a simple example for how to do it. I'm hoping to get around to it in the next few weeks, but we'll see. If anyone wants to help me code this (particularly some AJAX for the form) that would be great.

  15. wutrigy
    Member
    Posted 1 year ago #

    Thank you for your response. Thumbs up for the work.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.