-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.1.0' into categories-update
- Loading branch information
Showing
29 changed files
with
1,614 additions
and
739 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
* @author Eoxia <[email protected]> | ||
* @copyright (c) 2011-2020 Eoxia <[email protected]>. | ||
* @since 2.0.0 | ||
* @version 2.0.0 | ||
* @version 2.1.0 | ||
*/ | ||
|
||
namespace wpshop; | ||
|
@@ -48,14 +48,14 @@ public function can_add_product() { | |
* Ajoute un produit dans le panier. | ||
* | ||
* @since 2.0.0 | ||
* @version 2.0.0 | ||
* @version 2.1.0 | ||
* | ||
* @param Product $product Les données du produit. | ||
* @param integer $qty La quantité à ajouter. | ||
* | ||
* @return boolean True si tout s'est bien passé. | ||
*/ | ||
public function add_to_cart( $product, $qty = 1 ) { | ||
public function add_to_cart( $product, $qty = 1, $desc = '' ) { | ||
if ( ! $this->can_add_product() ) { | ||
return; | ||
} | ||
|
@@ -71,7 +71,8 @@ public function add_to_cart( $product, $qty = 1 ) { | |
|
||
if ( ! empty( Cart_Session::g()->cart_contents ) ) { | ||
foreach ( Cart_Session::g()->cart_contents as $key => $line ) { | ||
if ( $line['id'] === $product->data['id'] ) { | ||
$data['content'] = $desc; | ||
if ( $line['id'] === $product->data['id'] && Settings::g()->split_product() == false ) { | ||
$data['qty'] = $line['qty'] + $qty; | ||
$index = $key; | ||
break; | ||
|
@@ -83,6 +84,7 @@ public function add_to_cart( $product, $qty = 1 ) { | |
|
||
if ( $can_add ) { | ||
if ( -1 === $index ) { | ||
$data['content'] = $desc; | ||
Cart_Session::g()->add_product( $data ); | ||
} else { | ||
Cart_Session::g()->update_product( $index, $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
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
* @author Eoxia <[email protected]> | ||
* @copyright (c) 2011-2020 Eoxia <[email protected]>. | ||
* @since 2.0.0 | ||
* @version 2.0.0 | ||
* @version 2.1.0 | ||
*/ | ||
|
||
namespace wpshop; | ||
|
@@ -408,7 +408,9 @@ public function callback_checkout_proposal( $third_party, $contact ) { | |
* Créer la proposition commerciale lors du tunnel de vente. | ||
* | ||
* @since 2.0.0 | ||
* @version 2.0.0 | ||
* @version 2.1.0 | ||
* | ||
* @todo mettre la langue de l'user API pour la génération du doc | ||
* | ||
* @param Third_Party $third_party Les données du tier. | ||
* @param User $contact Les données du contact. | ||
|
@@ -461,6 +463,7 @@ public function callback_checkout_doli_proposal( $third_party, $contact ) { | |
Request_Util::put( 'documents/builddoc', array( | ||
'modulepart' => 'propal', | ||
'original_file' => $doli_proposal->ref . '/' . $doli_proposal->ref . '.pdf', | ||
'langcode' => 'fr_FR', | ||
) ); | ||
|
||
Cart_Session::g()->add_external_data( 'doli_proposal_id', $doli_proposal_id ); | ||
|
35 changes: 35 additions & 0 deletions
35
modules/dolibarr/doli-documents/action/class-doli-documents.action.php
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,35 @@ | ||
<?php | ||
/** | ||
* La classe gérant les actions des documents de Dolibarr. | ||
* | ||
* @package WPshop | ||
* @author Eoxia <[email protected]> | ||
* @copyright (c) 2011-2020 Eoxia <[email protected]>. | ||
* @since 2.1.0 | ||
* @version 2.1.0 | ||
*/ | ||
|
||
namespace wpshop; | ||
|
||
use eoxia\LOG_Util; | ||
use eoxia\View_Util; | ||
|
||
defined( 'ABSPATH' ) || exit; | ||
|
||
/** | ||
* Doli Documents Action Class. | ||
*/ | ||
class Doli_Documents_Action { | ||
|
||
/** | ||
* Le constructeur. | ||
* | ||
* @since 2.1.0 | ||
* @version 2.1.0 | ||
*/ | ||
public function __construct() { | ||
} | ||
} | ||
|
||
new Doli_Documents_Action(); | ||
|
112 changes: 112 additions & 0 deletions
112
modules/dolibarr/doli-documents/asset/doli-documents.backend.js
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,112 @@ | ||
jQuery(function($){ | ||
|
||
// Set all variables to be used in scope | ||
var frame, | ||
metaBox = $('#wps_product_gallery.postbox'), // Your meta box id here | ||
addImgLink = metaBox.find('.upload-custom-img'), | ||
delImgLink = metaBox.find( '.delete-custom-img'), | ||
imgContainer = metaBox.find( '.wps-product-gallery-container' ), | ||
imgIdInput = metaBox.find( '.wps-product-gallery-attachments-hidden-id' ); | ||
|
||
// ADD IMAGE LINK | ||
addImgLink.on( 'click', function( event ){ | ||
|
||
event.preventDefault(); | ||
|
||
// If the media frame already exists, reopen it. | ||
if ( frame ) { | ||
frame.open(); | ||
return; | ||
} | ||
|
||
// Create a new media frame | ||
frame = wp.media({ | ||
title: 'Select or Upload Media Of Your Chosen Persuasion', | ||
button: { | ||
text: 'Use this media' | ||
}, | ||
multiple: true // Set to true to allow multiple files to be selected | ||
}); | ||
|
||
|
||
// When an image is selected in the media frame... | ||
frame.on( 'select', function() { | ||
|
||
// Get media attachment details from the frame state | ||
var attachments = frame.state().get('selection').map( function ( attachment ) { | ||
attachment.toJSON(); | ||
return attachment; | ||
//imgContainer.append( '<img src="'+attachment.url+'" alt="" style="max-width:100%;"/>' ); | ||
//imgIdInput.val( attachment.id ); | ||
}); | ||
|
||
var i; | ||
|
||
for (i = 0; i < attachments.length; ++i) { | ||
|
||
//sample function 1: add image preview | ||
imgContainer.append( | ||
'<div class="myplugin-image-preview"><img src="' + | ||
attachments[i].attributes.url + '" alt="" style="max-width:100%;"></div>' | ||
); | ||
|
||
//sample function 2: add hidden input for each image | ||
imgIdInput.after( | ||
'<input type="hidden" name="myplugin_attachment_id_array[]" value="' + | ||
attachments[i].id + '" id="myplugin-image-input' + attachments[i].id + '">' | ||
); | ||
} | ||
|
||
// Send the attachment URL to our custom image input field. | ||
|
||
// Send the attachment id to our hidden input | ||
|
||
// Hide the add image link | ||
//addImgLink.addClass( 'hidden' ); | ||
|
||
// Unhide the remove image link | ||
//delImgLink.removeClass( 'hidden' ); | ||
}); | ||
|
||
// Finally, open the modal on click | ||
frame.open(); | ||
}); | ||
|
||
// DELETE IMAGE LINK | ||
delImgLink.on( 'click', function( event ){ | ||
|
||
event.preventDefault(); | ||
|
||
// Clear out the preview image | ||
imgContainer.html( '' ); | ||
|
||
// Un-hide the add image link | ||
addImgLink.removeClass( 'hidden' ); | ||
|
||
// Hide the delete image link | ||
delImgLink.addClass( 'hidden' ); | ||
|
||
// Delete the image id from the hidden input | ||
imgIdInput.val( '' ); | ||
|
||
}); | ||
|
||
}); | ||
|
||
/** | ||
* Gestion JS des assoications Dolibarr. | ||
* | ||
* @since 2.1.0 | ||
* @version 2.1.0 | ||
*/ | ||
window.eoxiaJS.wpshop.doliDocument = {}; | ||
|
||
/** | ||
* La méthode "init" est appelé automatiquement par la lib JS de Eo-Framework. | ||
* | ||
* @since 2.1.0 | ||
* @version 2.1.0 | ||
*/ | ||
window.eoxiaJS.wpshop.doliDocument.init = function() { | ||
|
||
}; |
Oops, something went wrong.