Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
$(function() { | ||
|
||
if ($("ul.products li").length > 0) { | ||
$("ul.products li select[name=color_id]").change(function() { | ||
var product_id = $(this).parent().find("input[name=product_id]").val(); | ||
var image_tag = $(this).parents("li").find("img.product_photo"); | ||
|
||
$.get( | ||
"/photos/image_tag.php", | ||
{ product_id:product_id, color_id:this.value }, | ||
function(data) { $(image_tag).replaceWith(data); } | ||
); | ||
}); | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<? | ||
|
||
$dir = dirname(__FILE__); | ||
require_once "$dir/../app/requires.php"; | ||
$db = new DB(); | ||
|
||
$photo = Photo::first(array( | ||
"where" => array( | ||
"product_id = ? AND color_id = ?", | ||
$_REQUEST["product_id"], | ||
$_REQUEST["color_id"] | ||
) | ||
)); | ||
|
||
?> | ||
<img src="<?= $photo->url("medium") ?>" width="300" height="300" class="product_photo"> |