Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Update xmlgenerator.php #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update xmlgenerator.php #2

wants to merge 1 commit into from

Conversation

liontarion
Copy link

No description provided.

After some trouble with XML and Skroutz suggestions about the structure of XML I have made some changes. Below are the changes as the skroutz suggest me...
1. Added manufacturer to the main title
2. Added the variable $vat_value to hold the VAT because product_price is without vat and math exp to calculate it. 
3. Added product avaliability after stock value check
4. Changed the exp when loop and add the products to the array so to check and export the products with unique ID and/or same category. That because of double records of both parent and sub categories.

Please feel free to corect me for any mistakes I was made.
Thank you.
@drakakisgeo
Copy link
Owner

Hello there :-) I'll need some time for this, I'll keep you posted.

$product_node->addChild('link',BASEURL."/".$this->e($this->get_url($item['id'])));
$product_node->addChild('price_with_vat',number_format($item['price'], 2, ',', ''));
$product_node->addChild('price_with_vat',number_format((($item['price'] * $this->vat_val) / 100) + $item['price'], 2, ',', '')); //NEW: Math exp to calculate the price with vat.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Θα το έκανα Optional αυτό. Δηλαδή μια μεταβλητή στο Setup define("PRICEINCVAT","FALSE"); για το αν η τιμή συμπεριλαμβάνει ΦΠΑ ή όχι και μετά μια function όπως

public function getFinalPrice($price,$priceincvat){
return ($priceincvat) ? $price : ($price * $this->vat_val) / 100) + number_format($item['price'], 2, ',', ''));
}

Να κάνει όλη την δουλειά σε αυτή την γραμμή, δηλαδή κάτι σαν

$product_node->addChild('price_with_vat',$this->getFinalPrice(number_format($item['price'], 2, ',', ''),PRICEINCVAT));

Δεν έχω τεστάρει τον παραπάνω κώδικα. Αν μπορείς δοκιμάσε το και το κάνω Merge. Στην περίπτωση του πελάτη μου, το σύστημα του είχε φτιαχτεί ( ανωμάλος βέβαια) να περιλαμβάνει στην τιμή το ΦΠΑ). Οπότε πρέπει να γινει optional.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants