So, I'm starting to take a crack at some Magento code. I'm trying to track down the code that calculate shipping on a shopping cart page. I'm looking at a file called shipping.phtml in /your_theme/template/checkout/cart/.
Zipcode input box:
<li>
<label for="postcode"<?php if ($this->isZipCodeRequired()) echo ' class="required"' ?>><?php if ($this->isZipCodeRequired()) echo '<em>*</em>' ?><?php echo $this->__('Zip/Postal Code') ?></label>
<input class="input-text validate-postcode<?php if ($this->isZipCodeRequired()):?> required-entry<?php endif;?>" type="text" id="postcode" name="estimate_postcode" value="<?php echo $this->htmlEscape($this->getEstimatePostcode()) ?>" />
</li>
Calculate shipping button:
<div class="buttons-set">
<button type="button" onclick="coShippingMethodForm.submit()" class="button"><span><span><?php echo $this->__('Get a Quote') ?></span></span></button>
</div>
Javascript:
<script type="text/javascript">
//<![CDATA[
var coShippingMethodForm = new VarienForm('shipping-zip-form');
var countriesWithOptionalZip = <?php echo $this->helper('directory')->getCountriesWithOptionalZip(true) ?>;
coShippingMethodForm.submit = function () {
var country = $F('country');
var optionalZip = false;
for (i=0; i < countriesWithOptionalZip.length; i++) {
if (countriesWithOptionalZip[i] == country) {
optionalZip = true;
}
}
if (optionalZip) {
$('postcode').removeClassName('required-entry');
}
else {
$('postcode').addClassName('required-entry');
}
return VarienForm.prototype.submit.bind(coShippingMethodForm)();
}
//]]>
</script>
Now, I have no idea where it goes from here. Could somebody provide me some hints as to where this goes from here?
EDIT:
I should add that I'm looking for the code that takes in the weight of the item and calculates the USPS shipping cost. I've read that a file named Usps.php is what calculate this rate, but I wasn't able to change how the cost is displayed on the site even with core file modifications, so I wanted to find out myself that is indeed the code that calculate the shipping rate.
[magento]/app/code/directory, but what are you trying to achieve? What exactly do you want from us for a usable answer, you're bing fairly vague on this.