The Official Website of AgoraCart and Agora.cgi
AgoraCart.com Demos Download AgoraCart User Manuals & Wiki Gold Members Forum Go Gold Now! Gold Version Memberships

AgoraCart.com

About
Features
Download
Payment Gateways
Send a Donation
Founders Club
BLOG: News & Updates

Showcases & Demos

AgoraCart Demos
Shop Live Stores

Downloads & Add-ons

Gold Version Downloads
DBwizz Database Mgr.
AgoraCart.com Store

Help & Support

User Manuals
Gold Version Users Forum
Gold Version Chat
Tech Support
Certified Agora Pros
Certified Designers
Hire a Freelancer

Gold Version Members

Member Benefits
Join Today!
Gold Members Home
Gold Version Users Forum
Gold Version Chat Rooms
Gold Version Downloads

For Store Owners

Merchant Accounts
Cool Resources
Advertise Here
"Powered by" Logos
Web Hosting Search

Misc.

Contact Us
MEET's Talking Guide
The Ancient Greek Agora






AgoraCart Free User Forums

This is the official FAQ and Cool Tips guide For the AgoraCart shopping Cart software


Official Sponsors of the AgoraCart Project:

       


RegisterSearchFAQLog in
This topic is locked: you cannot edit posts or make replies. Page 1 of 1
Code Allows For 0 Weight Items Wile Using The APIs
Author Message
Reply with quote
Post Code Allows For 0 Weight Items Wile Using The APIs 
hell-o
here is a repost by Dr. Vareem. it will allow for 0 to be added to the shipping then have the api skip over it . it works very good i have used it a number of times...
Quote:

--- In agora2@yahoogroups.com, "djvreeman" <djv5@c...> wrote:
For the UPS SBW module:

In the shipping_lib.pl file, find the "sub calc_ups" routine and
the
line:

if ($item_wt <= 1) {
$item_wt = 1;
}
Replace with:

if ($item_wt <= 0.1) {
next;
}
if (($item_wt <= 1) && (item_wt > 0.1)) {
$item_wt = 1;
}

This would skip calculating shipping for any items with weight
less
than or equal to 0.1 (e.g. 0), and round up the weight of anything
less than 1 but greater than 0.1 to 1.

For USPS look for the line:

if ($item_wt <= 1) { # min
$item_wt = 1;
}

and modify similar to above.

This seems to work well for my items that are available
electronically and not shipped by UPS. Hope this helps for others
with similar situations...

Regards,
Dr. Vreeman


he posted an update which i have corrected in the above.

Reply with quote
Post  
Hello Dr. Vareem! Thanks for the tip!

I have a site that sells both electronic and shippable products

I've applied the patch you mentioned to accommodate my electronic products.

Unfortunately, after the user hits 'checkout', with only an e-product in the cart (zero weight)
they are still presented with the blue table:
"Please select where your order will be shipped and click 'Next'"

And cannot proceed without supplying the information.

I use AuthorizeNET exclusively and I can edit the html/forms/AuthorizeNet-orderform.html to get rid of this error, as mentioned in other forum posts....
... But how will this affect my other 'shippable' products?

If I understand correctly this one orderform "AuthorizeNet-orderform.html" will be used for both products, and any e-product hacks I make to it are applied to my shippable products.

My perfect vision would be:
if shipping weight = 0 (it's an e-product)
use an order form with my new blue table: "Enter email to deliver e-product to" (for example)
else
use the order form that we all know and love.

(and the golden third option, do both tables if there is a combination e-product/shippable product in cart)

I can see this done 2 ways:

1) with 2 separate orderform.html files (a third even for combo carts)
2) or by tweaking the existing file with dynamic HTML (php?) to the existing orderform.html

Is this possible? plausible? or just plain crazy thinking?

I'm a proficient Perl programmer and 'code doctor' simply looking for advice from the author on where best to make my incisions and do surgery on the code Smile

Thanks in advance for any advice!

-Mike 'Flip' McFadden

P.S. - very tidy code indeed. very nice. I like.

View user's profile Send private message
Reply with quote
Post  
hell-o
no time to do the fun stuff but you may be able to do a conditional statement in the store/html/html-templates/cart_footer.inc file.
do the conditional statement for the checkout button...
if shipping is larger than .1 then...
<INPUT TYPE="IMAGE" NAME="order_form_button" VALUE="Complete Secure Order" SRC="%%URLofImages%%/complete_order.gif" BORDER="0">

if shipping eq 0 then
<INPUT TYPE=HIDDEN NAME="gateway" VALUE="AuthorizeNet">
<INPUT TYPE=submit NAME="submit_order_form_button" VALUE="Check Out">

if you're using auth.net exclusively (or maybe not) then this will take you to step two. be sure to take out the required fields in the auth.net order_lib.pl file.
if you need help or find the answer please post here. but you should be able to script as outlined...i think LOL.
regards,
dan

Reply with quote
Post Wish Me Luck! 
Hi Dan. Appreciate the response.

I Do use authorizenet exclusively, btw.

I'm now examining the files you mentioned in your reply, and going to try some stuff.
I think I know enough now to be dangerous and possibly even slightly productive Smile

To gain a bit more clarity on 'the big picture' here are my pending questions... which may very well be answered in my code-spelunking.

1) can you tell me a bit more about cart_footer.inc ? Where it is included? how it is included? and when is it referenced....
Grep will give me a good answer, but a developer cound give me a 'conceptual' answer as to 'why it is called' and 'what does it do'.

2) Dan Said: "This will bring you directly to step 2"
If I understand you correctly, this means I skip the state (let's call it step 1.5) where I am asked for shipping info and displayed the 'blue shipping info table/form'.
Step two is usuially where I get my errors if the shipping form is not completed...... and therefore the required validation edits to `library/AuthorizeNet-order_lib.pl`
(what dan called 'auth.net order_lib.pl')

I think I got it. Feel free to reply to clarify these things.

I'll be back to post my results this evening to help us all out.

(or ask another question!)

-Mike

View user's profile Send private message
Reply with quote
Post  
hell-o
check out - step one and step two...
traditionally step one is where the client fills in at least the state, shipping method and zipcode. there are processes that rely on this data such as shipping cost, taxes and shipping destination (api relies on the zipcode). there are other things that rely on this information as well but generally this is the only place the default store allows for this data. when submitted to step two then all relevant calculations are made for shipping, tax and final cost which is then passed to auth.net. with vitrual downloads this step can be bypassed... not taxes, no shipping and no need for the data.

step two accumulates the final values then passes the data to auth.net. cart id, final shipping costs totals are not user editable at auth.net so the core data is written in stone. some data that is passed to auth.net maybe edited in the secure auth.net form. you set those editable fields in the auth.net administration manager.

cart_footer - viewcart...
the cart_footer.inc is parsed only on the "view cart" page. this is where qty can be changed, items deleted, cart contents are sumarized and you can either continue shopping or check out. it's almost always best to run the client past this page prior to checking out so they can make adjustments to their cart contents if incorrect. for example they may hit the add to cart button one too many times if confused as to how to get to the page. this will add too much qty or an unnecessary product to their cart.
this file is part of a form. note the </form> tag at the bottom. so don't add another form unless it's below the </form> tag.
located in the store/html/html-templates folder

auth.net required fields - AuthorizeNet-order_lib.pl
the following are the required fields in the file. around line 65...
@sc_order_form_required_fields = (
"Ecom_ShipTo_Postal_StateProv",
"Ecom_ShipTo_Postal_PostalCode");
you can comment out these three lines to eliminate them.
this file is located in the store/library sub directory.

i think i was mistaken on the suggested links for the cart footer. default is...


Code:
<INPUT TYPE="IMAGE" NAME="order_form_button" VALUE="Complete Secure Order" SRC="%%URLofImages%%/complete_order.gif" BORDER="0">


and link (inputs) to step two is...

Code:
<INPUT
TYPE=HIDDEN NAME="gateway" VALUE="AuthorizeNet">
<INPUT TYPE=submit NAME ="submit_order_form_button" VALUE = "Next">


but i got those othe inputs from someplace so consider them. they maybe failed dev inputs. don't remember. LOL

it may even be possible to fo directly to auth.net from viewcart but i've never tried it. maybe a header redirect from the lib.pl file. but try without the redirect first. possibly an additional input on the checkout button would do it if necessary. providing your conditional are iron clad in the cart footer.

just holler if you need some help.
regards,
dan



Last edited by Dan on Fri Jun 17, 05 7:50 am; edited 1 time in total
Reply with quote
Post  
hell-o
join the pro group. there's all kinds of cool stuff there. you'll see codehooks, drop-in custom folder files, inventory and random displayed products from the dB and all sorts of cool stuff. sometimes it's just just fun making all this stuff work in one store...all the bells and whistles then tweaking them just for the fun of it. grin. when things are slow that is. Confused
regards,
dan

Reply with quote
Post Doing the work.... 
Still investigating, and putting a small diary together. Things are starting to focus, tho.

As for 'step 1' and 'step 2' I think I understand now.... this is all 'checkout' ... which is separate from 'view cart'.

This confusion is coming from folks like me thinking that 'view cart' is step 1 in the checkout process. It's actually step 0.

Let's see if my vocabulary is now correct.

Customer 'view's cart' (as always should just before checkout)
Customer clicks 'complete order'
(NAME="order_form_button" VALUE="Complete Secure Order")
which enters the beginning of step 1
Normal operation uses step 1 to display shipping info form.
Customer submits "NEXT" (
(NAME ="submit_order_form_button" VALUE = "Next")
shipping info 'should' also be set and and we move on to step 2


Now I think I understand what you mean by "hacking the 'complete order' button"

During "View Cart", the "complete order" button's name & value will be generated based on the weight values.

---

Idea:

To ease validation, we have 2 options:

1) edit AuthorizeNet-order_lib.pl and skip verification (as you suggest)
comment out and be risky, or do conditional validation based on cart weight.

2) add conditional hidden fields to cart_footer.inc when cart has 0 weight. Inputs "Ecom_ShipTo_Postal_StateProv" and "Ecom_ShipTo_Method" set to bogus values.
- this at least passes a value to order_lib.pl and validation passes.
<INPUT TYPE="HIDDEN" NAME="Ecom_ShipTo_Postal_StateProv" Value="not blank, but ok">

Someone else mentioned option #2 in a related post. What do you think?

#2 is the direction I'm going right now - against your advice for the moment.
(not that I don't respect every last byte of advice you type!)

Your suggestion? Comments?

(here come the edits! Hold your breath!)

View user's profile Send private message
Reply with quote
Post Hollering! Very specific question tho... 
Working in cart_footer.inc. Using <!--agorascript-pre --> Possibly incorrectly.

Wondering how to get scope on a 'shipping weight' variable.

I attempted to use %%shippingWeight%% (found in agora_html_lib.pl, line 1285)
Hoping that a substution would occur....
But I think the substution is done too late.... got the error:

Bareword found where operator expected at (eval 31) line 1, near "%%shippingWeight", referer: http://www.mysite.com/cgi-bin/my_install_dir/agora.cgi
(among other errors)

I'm going to try the variable $display_fields[5]. I hope it's in scope.

Any other suggestions for doing this?


Tried and failed applying this patch to cart_footer.inc:

CHANGE:

<INPUT TYPE="IMAGE" NAME="order_form_button" VALUE="Complete Secure Order" SRC="%%URLofImages%%/complete_order.gif" BORDER="0">


TO:
<!--agorascript-pre
if(%%shippingWeight%% > 0) {
. return '<INPUT TYPE="IMAGE" NAME="order_form_button" VALUE="Complete Secure Order" SRC="%%URLofImages%%/complete_order.gif" BORDER="0">';
} else {
. return '<INPUT TYPE=HIDDEN NAME="gateway" VALUE="AuthorizeNet">\n<INPUT TYPE=submit NAME="submit_order_form_button" VALUE="Check Out">';
}
-->

(dots added to preserve code indents only)

View user's profile Send private message
Reply with quote
Post  
It's hard to remember what the scope is at certain levels, but when I lose track on big prjects I jsut reverse back thru the sub routine calls (functions fer those of other programming platforms). It'll trick down from there as you'd expect on most things. You also have to beware of when you set variables in agorascript as they appear in different levels and can affect scope.

ME


_________________
Vote Mister Ed for Prez 2012, for a REAL change.

Need Low Cost Startup Option? Try NiftyPay's Pay to Play
http://www.NiftyPay.com
View user's profile Send private message Visit poster's website
Reply with quote
Post Solved, in members forums 
Yep. What we discussed has been accomplished.

It's all documented in the members only forums.

So, if you - the reader - got this far and still confused, go pay your agoracart dues and see the answer in the members area.

http://members.agoracartpro.com/proforum/viewtopic.php?p=5529#5529

View user's profile Send private message
Reply with quote
Post  
hell-o
Laughing
figured you'ld join. have fun with the coding.
regards,
dan

Reply with quote
Post  
Hi Dan

I am using v5 and I cannot find shipping_lib.pl

Does it exist in v5?

Cheers

Dave

View user's profile Send private message
Reply with quote
Post  
Dave,
This thread is ONLY in reference to v4.x.
This solution should not be implemented in v5.

HTH!


_________________
God Bless!
Bonnie - AgoraCart Moderator

Get a Gold Membership
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger ICQ Number
Reply with quote
Post  
Thanks Bonni

I have got the USPS to work - at last! but one small problem. I am now having to add 0.1 to the shipping weight of every item in the product database - a long cumbersome job with about 280 products! Is there a way I can access the database as spreadsheet or table so I can do a global add?

I really appreciate all your help you have given me. I work in conservation writing, publishing and doing media work so this to me is an enjoyable if a challenge form of relaxation!

Cheers

Dave

View user's profile Send private message
Reply with quote
Post  
Bonnie its me again!

You gave me this reply a while back about the requirement at present in v5 to have a state chosen in the shipping page:

What version of the cart are you using?
Only v5 will handle international shipments originating from the US.

If you are shipping via New Zealand Post, you will need to use custom shipping logic.

As for the "State/Province" field, you can change that field in the order form from a drop-down select box to a text box. Also, if you don't want it as a required field, you will need to edit the gateway's *-order_lib.pl file's required fields array.

I guess what I need in the State/Province box is a N/A. I am not clear from your answer above just what I should do or where I find the *-order_lib.pl file to edit?

Cheers

Dave

View user's profile Send private message
Reply with quote
Post  
Dave,
*-order_lib.pl files are found in the 'library' directory of the store.

HTH!


_________________
God Bless!
Bonnie - AgoraCart Moderator

Get a Gold Membership
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger ICQ Number
Reply with quote
Post access the database as spreadsheet... 
To Davewiki,

>>Is there a way I can access the database as spreadsheet or table so I can do a global add?

You can edit database.csv in Microsoft Excel.
/store/data_files/database.csv

~Ken

Display posts from previous:
This topic is locked: you cannot edit posts or make replies. Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum