Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. <?php
  2.  
  3. $_GET["event"];
  4. $sku = $_GET["event"];
  5.  
  6. $vPath = $sku.".html";
  7. $oRewrite = Mage::getModel('core/url_rewrite')
  8. ->setStoreId(Mage::app()->getStore()->getId())
  9. ->loadByRequestPath($vPath);
  10.  
  11. $iProductId = $oRewrite->getProductId();
  12. $oProduct = Mage::getModel('catalog/product')->load($iProductId);
  13.  
  14. $id = $iProductId;
  15.  
  16. //get id from url key END
  17.  
  18. $productModel = Mage::getModel('catalog/product');
  19.  
  20. $product = $productModel->load($id);
  21.  
  22. $sku = $product->getData('sku');
  23. $name_product = $product->getName(); // same as $product->getData('name');
  24. ...
  25. ...
  26. ...
  27.  
  28. /// show the product in the page
  29.  
  30. <?php if($attVal){?>
  31. <div class="container-options">
  32. <?php // loop through the options
  33. foreach($attVal as $optionKey => $optionVal) {
  34. $a = $a+1;
  35. if($optionVal->getType() == 'area'){?>
  36. <div class="cus-option-<?php echo $a; ?>">
  37. <label id="title-option"<?php if ($optionVal->getIsRequire()) echo ' class="required"' ?>><?php if ($optionVal->getIsRequire()) echo '<em>*</em>' ?><?php echo $this->escapeHtml($optionVal->getTitle()) ?></label>
  38. <textarea id="options_<?php echo $optionVal->getId() ?>_text" onchange="opConfig.reloadPrice()" class="<?php echo $optionVal->getIsRequire() ? ' required-entry' : '' ?> <?php echo $optionVal->getMaxCharacters() ? ' validate-length maximum-length-'.$optionVal->getMaxCharacters() : '' ?> product-custom-option" name="options[<?php echo $optionVal->getId() ?>]" rows="5" cols="25"><?php echo $optionVal->getDefaultValue() ?></textarea>
  39. </div>
  40. <?php }
  41. }?>
  42. </div>
  43. <?php } //endif product has custom option or not?>
  44. <!--- add to product -->
  45.  
  46. /// here, I need the code to put the costum option with the quantity that will change the price of the product with the options. This can be static. (Will be the same for all product)
  47.  
  48. <form action="<?php echo Mage::helper('checkout/cart')->getAddUrl($model).'?return_url='?><?php echo $base_url.'checkout/onepage/';?>" method="post" id="product_addtocart_form_<?php echo $model->getId()?>">
  49. <div class="cont_qty">
  50.  
  51. <label for="qty">QTY:</label>
  52. <input type="text" name="qty" id="qty" maxlength="12" value="1" title="Qty" class="input-text qty">
  53.  
  54. <label for="price">Price:</label>
  55. <span class="popprice">
  56. <?php echo '$'.number_format($model->getPrice(),2);?>
  57. </span>
  58.  
  59. <button type="submit" class="button" title="Add To Cart">
  60. <span>Add To Cart</span>
  61. <i class="fa fa-cart-plus"></i>
  62. </button>
  63. </div>
  64. </form>
  65.  
  66. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement