I am developing a module that creates a few custom entities which relate/impact the options available for a particular product. Here's how it works:
When a product loads, a query is performed on my custom entities using two of the product's attributes.
I use the result of the query and present it in a 2-step fashion, like this (the customer's first selection impacts the options available for their second):
Here's what I know I need to accomplish on the frontend:
1. Override two pieces of logic in Product view.phtml:
<form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
... you'll notice
enctype="multipart/form-data" only gets added if
true, and my products won't actually have them (so this would return
<?php if ($_product->isSaleable() && $this->hasOptions()):?> <?php echo $this->getChildChildHtml('container1', '', true, true) ?> <?php endif;?>
... also because my products won't actually have custom options, so
$this->hasOptions() would return
false and prevent rendering of container1.
2. Replace/overwrite/override 'container1' -- the child block (is it a block?) that "contains" the html for the custom options, as shown here:
I've read a few posts that claim that copying
view.phtml and editing it directly is not the correct way to do this, but what's the alternative?
Second, I've read I can either
container1 piece -- which method should I use, and then how do I correctly substitute my own
Thank you very much!