PHP SQL help

Completed Posted Jun 16, 2014 Paid on delivery
Completed

I need some help with a wordpress woocommerce site

We have a custom php page

it is calling a "variation attribute" to display product variations and pricing options from variable products

if the product is not a variable product i.e. a "simple product without variations"

it is not displaying any additional products underneath it, it is breaking the code.

Heres what we need to do is insert some code to allow it to continue in the event it is a simple product i.e. "has no variaitons" so a if then continue

Then we also need to add in the ability for it to pull a additional variation for (color) right now it only pulls size I have been able to get it to do this but then it doubles all fields so i need it to do so without doubling

The current code where I am having this issue is

<span class="price">

<?php $available_variations = $product->get_available_variations(); //echo '<pre>';print_r($available_variations);echo '</pre>'; die;

// lets talk variations here

foreach($available_variations as $prod_variation) {

$size_pro = $prod_variation['attributes']['attribute_pa_size'];

$price_pro = $prod_variation['price_html']; $price_pro2 = strip_tags($price_pro);

echo $result= '<span class="amount">'.$size_pro.' '.$price_pro2.'</span>&nbsp;&nbsp;';

}

?></span>

* as you can see there is no bypass for a product without variations

by adding this line I have been able to get it to pull the color variation

$size_pro = $prod_variation['attributes']['attribute_pa_color'];

** but then it does two rows of boxes one for size which is blank because this product doesnt have sizes just color variations :)

In addition it is throwing the error below :)Fatal error: Call to undefined method WC_Product_Simple::get_available_variations() in

/home/.............."filename"etc:0

which is because a simple product does not have any variations

This should be a fairly simple quick fix for a skilled php developer I am hiring for 1 hours work that is plenty of time to resolve this php issue after which I am hiring a css expert as well as i have some css adjustments to be made lowest most capable bidder will win its a quick fix quickpayment quick review please bid accordingly

heres some code from the single product php file that I am presuming a portion of it if implemented in the troubled code above would fix the issue but i just cannot determine which portion and everytime i mess with it I am getting syntax errors I am sure I am just not being patient enough and getting frustrated so I figured instead of sitting here banging my head against the desk i would hire someone to provide the needed insight.

In addition after resolving this task I need some css work done so let me know if you can do both and i will hire you on for the css work also

PHP SQL WordPress

Project ID: #6077123

About the project

3 proposals Remote project Active Jun 16, 2014

Awarded to:

navneet008

Dear Hiring Manager, If you would like high quality work with a fast turn around for a fair price, contact me. You won't be disappointed. I enjoy working on all kinds of creative and innovative projects. I am c More

$5 USD / hour
(54 Reviews)
5.2

3 freelancers are bidding on average $5/hour for this job

gwebdesignplus

Hello Sir or Ma'am, My name is Sunny, and I am a Website Developer by profession. I came across your project posting and thought of writing to you. I have read all your requirements and interested to develop a More

$5 USD / hour
(5 Reviews)
4.4
VishalKapoor007

Hi, I have taken a detailed look at the job specifications and the job specs are 100% within my skill set. It would be my pleasure to work with you and deliver your job SUCCESSFULLY. I would like to draw your atte More

$6 USD / hour
(0 Reviews)
0.0