Skip to content

Instantly share code, notes, and snippets.

@eqdw
Created November 28, 2010 23:37
Show Gist options
  • Save eqdw/719399 to your computer and use it in GitHub Desktop.
Save eqdw/719399 to your computer and use it in GitHub Desktop.
<!--So basically what I'm doing, is filling an array with key/val pairs for each special property. This way we keep the html cleaner below
THIS IS NEAR THE TOP of theme042/template/view.phtml
-->
<?php
$_helper = $this->helper('catalog/output');
$_product = $this->getProduct();
$_details = array();
//THIS IS INCREDIBLY UGLY. I want to kill myself for writing this
$tmp = new stdClass;
$tmp->name = "Back";
$tmp->val = $_product->getBack();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Band Color";
$tmp->val = $_product->getBandColor();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Bracelet Length";
$tmp->val = $_product->getBraceletLength();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Carat Quality";
$tmp->val = $_product->getCaratQuality();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Carat Weight";
$tmp->val = $_product->getCaratWeight();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Clarity";
$tmp->val = $_product->getClarity();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Clasp Type";
$tmp->val = $_product->getClaspType();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Color";
$tmp->val = $_product->getColor();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Cut";
$tmp->val = $_product->getCut();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Description";
$tmp->val = $_product->getDescription();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Diamond Color";
$tmp->val = $_product->getDiamondColor();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Finish";
$tmp->val = $_product->getFinish();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Gender";
$tmp->val = $_product->getGender();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Manufacturer";
$tmp->val = $_product->getManufacturer();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Metal Color";
$tmp->val = $_product->getMetalColor();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Movement Type";
$tmp->val = $_product->getMovementType();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Necklace Length";
$tmp->val = $_product->getNecklaceLength();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Ring Size";
$tmp->val = $_product->getRingSize();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Setting";
$tmp->val = $_product->getSetting();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Shape";
$tmp->val = $_product->getShape();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Stone Position";
$tmp->val = $_product->getStonePosition();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Thickness";
$tmp->val = $_product->getThickness();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Type";
$tmp->val = $_product->getType();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Weight";
$tmp->val = $_product->getWeight();
$_details[] = $tmp;
$tmp = new stdClass;
$tmp->name = "Width";
$tmp->val = $_product->getWidth();
$_details[] = $tmp;
?>
<!-- THIS IS NEAR THE BOTTOM of theme042/template/view.phtml -->
<!--
for each iteration of the foreach loop, $detail is an anonymous object (ie javascript style object literal)
with two params: ->name and ->val. Name is a human-readable form of the param's name, and val is the value
as set in the backend. If the param is not defined on the current product, val is the empty string.
I do the check within the foreach to make sur eI'm not printing names for undefined parameters
-->
<?php foreach( $_details as $detail): ?>
<?php if ($detail->val): ?>
<dl>
<dt>NAME: <?php echo $detail->name; ?></dt>
<dd>VAL: <?php echo $detail->val; ?></dt>
</dl>
<?php endif; ?>
<?php endforeach; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment